• StephenJacobGoldberg
  • NEWBIE
  • 50 Points
  • Member since 2010

  • Chatter
    Feed
  • 2
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 21
    Replies

Hi All, 

 

I think this is probably impossible, but wanted to see if anyone had any genius ideas.... 

 

 

I want to build a query using all variables.  So for example, I would have an object var, a fields list var, an operator var, and a value var.  So it would look something like this in my head:

 

List<object>  myList  =  new List<object>([select fields list FROM object WHERE field operator value]); 

 

 

 

Any thoughts?  

 

 

 

Hi - 

 

I'm looking for an experienced Salesforce.com Developer to join our Salesforce.com practice.  Need someone who has solid development background, native English speaker, and located in Denver, CO.  

 

Very solid consulting company, with lots of Salesforce.com projects in our pipeline and looking for consultants to fill those positions.   

 

Please shoot me an email if you are interested in learning more 

 

stephen.goldberg@statera.com 

443.677.5454

I have a command button, and when I try and use it in the visualforce page I am not able to reterive the paramter from the page, it returns null

 

Here is the visualforce code

 

 

<apex:page standardController="Account" extensions="Controller_DupeChecker">
<apex:form >
<apex:dataTable value="{!DupeAccounts}" var="das" width="100%" border="1px" style="text-align:center">
<apex:column headerValue="Account Names" value="{!das.Name}"/>
<apex:column headerValue="Phone" value="{!das.Phone}"/>
<apex:column headerValue="Shipping Street" value="{!das.ShippingStreet}"/>
<apex:column headerValue="Billing Street" value="{!das.BillingStreet}"/>
<apex:column >
<apex:commandButton action="{!MergeAccounts}" value="Merge" id="theButton">
<apex:param name="acid" value="{!das.id}"/>
</apex:commandButton>
</apex:column>
<apex:column >{!das.id}</apex:column>
</apex:dataTable>

</apex:form>
</apex:page>

 

 

 

 

And here is the apex class

 

	public PageReference MergeAccounts(){
	// aid is not passing a value 	
	Id aid = System.currentPageReference().getParameters().get('acid');
	
	List<Account> mergeAccounts = new List<Account>();
	system.debug('aid: '  + aid);
	
	Account mergeAccount = ([select Id FROM Account WHERE Id =:aid]);
	//merge function doesn't bring over fields
	merge acc mergeAccount;
	return null;
	}

 

 

Please help!

 

I have a trigger which calls a method in an apex class to update an object.  I am getting the error "execution of AfterUpdate caused by: System.FinalException: Record is read-only: Class.CommissionHelper.updateCommissions: line 49, column 6" and I am not sure why please help! 

 

Apex class

 

 

public static void updateCommissions(List<Commission__c> commList){
		List<Quote> quoteList = new List<Quote>();
		List<Commission__c> commUpdateList = new List<Commission__c>();
		Set<ID> qIds = new Set<ID>();
		for(Commission__c c: commList){
			qIds.add(c.Quote__c);
			
			
		}
		
		quoteList = [select Id, Sales_Commission__c FROM Quote where id in: qIds];
		
		for(Commission__c c: commList){
			for(Quote q: quoteList){
				if(q.id == c.Quote__c){
					c.Sales_Commission__c = q.Sales_Commission__c * c.Split_Percentage__c/100;
					commUpdateList.add(c);
				}
			}
		}
		
		update commUpdateList;
		
	}

 

 

Apex Trigger

 

 

 

trigger Commission_Before on Commission__c (after insert, after update) {
	
	Map <id, double> totalSplitMap = new Map<id, double>();
	totalSplitMap = CommissionHelper.caclulateTotalSplit(Trigger.new);
	system.debug('totalSplitMap: ' + totalSplitMap);
	
	for(Commission__c c: Trigger.new){
		system.debug('totalSplit: ' + totalSplitMap.get(c.id) );
		if(totalSplitMap.get(c.id) > 100){
			
			c.addError('The Total Commission across splits must equal 100. It is currently equal to ' + totalSplitMap.get(c.id));
			
			
		}
		else{
			
			CommissionHelper.updateCommissions(Trigger.new);
		}
		
	
		
		
		
	}
	
	 

	
}

 

 

Hi - 

 

I am trying to get this visualforce page to align right so that it looks like it is part of the page, but no matter what I try if I use the Salesforce standard style classes, "dataCol" and "labelCol", it won't align right.  I've tried using inlline style with outputText fields, I've tried div tags, I've tried everything I think of,... please help.

 

Here is the code

<apex:page showHeader="false" standardController="Event" extensions="Controller_eventTZPage" >
 <apex:variable var="newUI" value="newSkinOn" 
        rendered="{!$User.UIThemeDisplayed = 'Theme3'}">
      
    </apex:variable>


<apex:pageBlock mode="maindetail">
<apex:pageBlockSection >
 
<TABLE cellspacing="0" cellpadding="0" width="100%" height="100%"  class="eventable" id="eventtable">
<TR>
<TD class="labelCol">Time Zone:</TD><TD class="dataCol"> <A href="{!UserURL}?noredirect=1" target="_newindow" >GMT{!UserProfileTimezone} ({!TimeZoneSidKey})</A></TD>
</TR>
<TR>
<TD class="labelCol">Local Start Time: </TD><TD class="dataCol"> {!TZStartTime}</TD>
</TR>
<TR>
<TD class="labelCol">Local End Time: </TD><TD class="dataCol"> {!TZEndTime}</TD>
</TR>
</TABLE>

</apex:pageBlockSection>

</apex:pageBlock>
</apex:p

 here is how it appears

 

US based consulting company looking to partner with an offshore firm.  Need to have deep SFDC knowledge, and spoken and written English competency.   Please send me a PM with rates per hour, location, number of resources, and average years of exp per resource.  

I have a datatable and I am passing a list to the table all my other merge fields are displaying one value only but the Quantity field is displaying the whole list.  I am not sure why this is happening.  Thanks in advance.

 

Here is the relevant code from the controller class

 

 

public List<double> getQuantities(){
    List<Double> quantities = new List<Double>();
    for(QuoteLineItem qti :theLineItems){
       if(qti.Description.contains('Cage') ||    
                 qti.Description.contains('cage') ||   
                 qti.Description.contains('Private') || 
                 qti.Description.contains('private')){
            quantities.add(1);
				
        }
       else{
            quantities.add(qti.Quantity);
        }		
			
   }		
      return quantities;
}

 

 

the relevant code from the vforce page

 

 

<DIV width="100%"  style="background-color: #807F84; color: #FFFFFF;">Monthly Recurring Charges </DIV>
<apex:dataTable value="{!LineItems}" var="LIs" width="100%" border="1px" >
<apex:column headerValue="Line Item" value="{!LIs.Description}" headerClass="tableHead"/>
<apex:column headerValue="Quantity" value="{!Quantities}"/>
<apex:column headerValue="Unit Price" value="{!LIs.UnitPrice}"/>
<apex:column headerValue="MRC" value="{!LIs.Total_MRC__c}"/>
</apex:dataTable>
  

Hi.

 

I am getting the following error on a vforce page I am trying to create

 

Save error: Unknown property 'VisualforceArrayList.Description'

 

and I have no idea why.  I have treid using a list, and not using a list.  I have tried everything I can think of, but nothing seems to help.    Any help is much appreciate so thank you in advance.

 

Here is the relevant parts  of the controller class

 

public with sharing class Controller_QuotePage {
   public Quote qt {get; set;}
   public List<QuoteLineItem> theLineItems {get; set;}
   public Controller_QuotePage(ApexPages.StandardController controller) 
   {
       Id quoteID = ((Quote) controller.getRecord()).Id;
       loadQuote(quoteId);
       loadQuoteLineItems(quoteId);
    }
 	
    public List<QuoteLineItem> getLineItems(){
		 
		 return theLineItems;
    }
	

   private void loadQuote(String quoteId) {
        this.qt = [Select Id,  Site_Address__c,       
                  CreatedDate,ExpirationDate FROM Quote where    
                  Id=:quoteId];  
      
   }
    
   private void loadQuoteLineItems(String quoteId) {

       this.theLineItems = [SELECT Id, Description, Quantity, UnitPrice,
	     	            TotalPrice,Total_MRC__c,   Total_NRC__c    
                             FROM QuoteLineItem WHERE QuoteId =:   
                             quoteId];	
	   		
    }


}

 

 

And here is the relevant parts of the visualforce page

 

 

<apex:page standardController="Quote" renderAs="pdf"
	extensions="Controller_QuotePage">

<apex:dataTable value="{!LineItems}" var="LineItems">
<apex:column headerValue="Line Item" value="{!LineItems.Description}"/>
</apex:dataTable>


</apex:page>

 

 

 

I have a command button, and when I try and use it in the visualforce page I am not able to reterive the paramter from the page, it returns null

 

Here is the visualforce code

 

 

<apex:page standardController="Account" extensions="Controller_DupeChecker">
<apex:form >
<apex:dataTable value="{!DupeAccounts}" var="das" width="100%" border="1px" style="text-align:center">
<apex:column headerValue="Account Names" value="{!das.Name}"/>
<apex:column headerValue="Phone" value="{!das.Phone}"/>
<apex:column headerValue="Shipping Street" value="{!das.ShippingStreet}"/>
<apex:column headerValue="Billing Street" value="{!das.BillingStreet}"/>
<apex:column >
<apex:commandButton action="{!MergeAccounts}" value="Merge" id="theButton">
<apex:param name="acid" value="{!das.id}"/>
</apex:commandButton>
</apex:column>
<apex:column >{!das.id}</apex:column>
</apex:dataTable>

</apex:form>
</apex:page>

 

 

 

 

And here is the apex class

 

	public PageReference MergeAccounts(){
	// aid is not passing a value 	
	Id aid = System.currentPageReference().getParameters().get('acid');
	
	List<Account> mergeAccounts = new List<Account>();
	system.debug('aid: '  + aid);
	
	Account mergeAccount = ([select Id FROM Account WHERE Id =:aid]);
	//merge function doesn't bring over fields
	merge acc mergeAccount;
	return null;
	}

 

 

Please help!

 

Is there a way to return a JavaScript array of Strings from Apex? Or is there a datatype in Javascript I need to use for an Apex List<String>?

 

 

A simple example of what I'd like to do:

 

Apex function:

 

public List<String> getStringList(){

 

    List<String> example =  {"email@gmail.com","email@yahoo.com","email@mac.com"};

 

   return example;

 

}

 

Javascript function in VisualForce

 

var stringList;

function() {

 

stringList = {!String};

document.writeln(stringList[0]);

 

}

 

 

  • November 15, 2010
  • Like
  • 0

I have asked three questions on these forums over the past few weeks and I have not received any responses. I feel like I am wasting my time here

 

Is there paid support for developers? I am willing to pay.

Hello

 

I need help with adding the Save & New button to my Customer Portal.  On the edit page, the only buttons I have are Submit and Cancel.

 

Clyde

London

 Hi All,

 

I have developed a visualforce page and rendered that page as PDF. I have applied font styles and css styles.

When i render the page as PDF font styles are not applied on PDF, but if make it as simple vf page i'm able to see the font style changes. Please help me to sort out this issue.

 

Thank you.

I have a trigger which calls a method in an apex class to update an object.  I am getting the error "execution of AfterUpdate caused by: System.FinalException: Record is read-only: Class.CommissionHelper.updateCommissions: line 49, column 6" and I am not sure why please help! 

 

Apex class

 

 

public static void updateCommissions(List<Commission__c> commList){
		List<Quote> quoteList = new List<Quote>();
		List<Commission__c> commUpdateList = new List<Commission__c>();
		Set<ID> qIds = new Set<ID>();
		for(Commission__c c: commList){
			qIds.add(c.Quote__c);
			
			
		}
		
		quoteList = [select Id, Sales_Commission__c FROM Quote where id in: qIds];
		
		for(Commission__c c: commList){
			for(Quote q: quoteList){
				if(q.id == c.Quote__c){
					c.Sales_Commission__c = q.Sales_Commission__c * c.Split_Percentage__c/100;
					commUpdateList.add(c);
				}
			}
		}
		
		update commUpdateList;
		
	}

 

 

Apex Trigger

 

 

 

trigger Commission_Before on Commission__c (after insert, after update) {
	
	Map <id, double> totalSplitMap = new Map<id, double>();
	totalSplitMap = CommissionHelper.caclulateTotalSplit(Trigger.new);
	system.debug('totalSplitMap: ' + totalSplitMap);
	
	for(Commission__c c: Trigger.new){
		system.debug('totalSplit: ' + totalSplitMap.get(c.id) );
		if(totalSplitMap.get(c.id) > 100){
			
			c.addError('The Total Commission across splits must equal 100. It is currently equal to ' + totalSplitMap.get(c.id));
			
			
		}
		else{
			
			CommissionHelper.updateCommissions(Trigger.new);
		}
		
	
		
		
		
	}
	
	 

	
}

 

 

Hi: I would like to display status color on custom VF page. I defined a color field as a formula text. The color field displays right color in standard object screen. It does not work when I tried to use the same field in Visualforce. The code is given below The display shows the value Yellow instead of the yellow color. I appreciate any help.

I am fairly new to Apex and Force.com in general. I have been going through the Force.com Workbook (the one that comes with Eclipse Force IDE Help File) which has an example Adding Apex Trigger, with the following code:

trigger HandleProductPriceChange on Merchandise__c (after update) {

List<Line_Item__c> openLineItems =
   [SELECT j.Unit_Price__c, j.Merchandise__r.Price__c
   FROM Line_Item__c j
   WHERE j.Invoice_Statement__r.Status__c = 'Negotiating'
   AND j.Merchandise__r.id IN :Trigger.new
   FOR UPDATE];

}

The problem: The reference  j.Invoice_Statement__r.Status__c don't work. The code code-complete-assist show me j.invoice_Statement__r and I can't see Status__c attribut.
Error: "Save error: Didn't understand relationship 'Unit_Price__c' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.    Force.com save problem"

Can you help me please? Thank

  • November 05, 2010
  • Like
  • 0

I'm just learning, so please bear with me.  I'm making a case-merge application.  The user selects cases to be merged and presses a list button.  This launches a VF page that displays the selected cases in an apex:pageBlockTable.

 

I would now like to add a number of summary columns to this table.  The summary columns show how many emails, tasks, attachments, etc.. each of the cases to be merged has.

 

In my VF page I have:

 

<apex:pageBlockTable value="{!SelectedCases}" var="item">

  <apex:column value="{!item.CaseNumber}"/>

  <apex:column value="{!item.Subject}"/>

  ...etc...

</apex:pageBlockTable>

 

In my class I have:

 

public Case[] getSelectedCases() {

  Set<Id> selectedCaseIds = new Set<Id>();

  for (SObject c : setCon.getSelected()) {

     selectedCaseIds.add(c.Id);

  }

  SObject[] items = [SELECT c.Id, c.CaseNumber, c.Subject, c.Contact.Name, c.Account.Name, 

    c.CreatedDate, c.Origin, c.LastModifiedDate FROM Case c WHERE Id IN :selectedCaseIds];

  return items;

}

 

 

I now would like to add a number columns to my table that are the results of queries like:

SELECT count() FROM CaseComment cc WHERE cc.ParentId = EACH CASE ID IN THE ABOVE SET;

 

so my ultimate display shows

 

<apex:pageBlockTable value="{!SelectedCases}" var="item">

  <apex:column value="{!item.CaseNumber}"/>

  <apex:column value="{!item.Subject}"/>

  <apex:column value="{!item.CountOfCaseComments}" />

  ...etc...

</apex:pageBlockTable>

How do I make a 'custom' object that will be rendered in the pageBlockTable where I can add attributes from various sources?

 

Thanks!

 

Hello Everyone,

 

I'm having a real hard time styling an apex:pageBlockTable. I have a series of four columns containing fields from a custom object, and then another field containing a long description that I position underneath the previous fields using breakbefore="true" . I am spreading this field to the whole length of the row using colspan="4". The problem is that the lines betweens the columns and rows are behaving strangely and I can find no way of altering them. My ideal result would be for the rows to be clearly identifiable as "belonging to each other", placing borders between "pairs" of rows for example.

 

To illustrate the problem, I have built up a similar example using the contact object instead of my custom object. 

 

Page Code

 

<apex:page controller="StylePageBlockTableController">
    <apex:pageBlock >
        <apex:pageBlockTable value="{!allContacts}" var="contact">
            <apex:column value="{!contact.Name}" headervalue="Full Name"/>
            <apex:column value="{!contact.Title}" headervalue="Title"/>
            <apex:column value="{!contact.Department}" headervalue="Department"/>
            <apex:column value="{!contact.Phone}" headervalue="Phone"/>
            <apex:column value="{!contact.Email}" breakBefore="true" colspan="4"/>
        </apex:pageBlockTable>
    </apex:pageBlock>         
</apex:page>
<apex:page controller="StylePageBlockTableController">
    <apex:pageBlock >
        <apex:pageBlockTable value="{!allContacts}" var="contact">
            <apex:column value="{!contact.Name}" headervalue="Full Name"/>
            <apex:column value="{!contact.Title}" headervalue="Title"/>
            <apex:column value="{!contact.Department}" headervalue="Department"/>
            <apex:column value="{!contact.Phone}" headervalue="Phone"/>
            <apex:column value="{!contact.Email}" breakBefore="true" colspan="4"/>
        </apex:pageBlockTable>
    </apex:pageBlock>         
</apex:page>

 

Controller Code

 

public class StylePageBlockTableController {
    
    public List<Contact> getAllContacts(){
        return [select Name, Title, Department, Email, Phone from Contact limit 5 ];
    }
}

 

Here is a screenshot of the table, as I have highlighted, there is a random "missing border line" that always appears (or rather doesn't) at exactly half way down the table. No matter what the size of the table, this missing line is always in the middle.

 

Problems displaying pageBlockTable

 

I have tried using style classes and the rules attribute (which seems utterly redundant and does not seem to affect anything, perhaps the new SF styling??)  amongst others. Any ideas anyone, greatly appreciated! 

I have a datatable and I am passing a list to the table all my other merge fields are displaying one value only but the Quantity field is displaying the whole list.  I am not sure why this is happening.  Thanks in advance.

 

Here is the relevant code from the controller class

 

 

public List<double> getQuantities(){
    List<Double> quantities = new List<Double>();
    for(QuoteLineItem qti :theLineItems){
       if(qti.Description.contains('Cage') ||    
                 qti.Description.contains('cage') ||   
                 qti.Description.contains('Private') || 
                 qti.Description.contains('private')){
            quantities.add(1);
				
        }
       else{
            quantities.add(qti.Quantity);
        }		
			
   }		
      return quantities;
}

 

 

the relevant code from the vforce page

 

 

<DIV width="100%"  style="background-color: #807F84; color: #FFFFFF;">Monthly Recurring Charges </DIV>
<apex:dataTable value="{!LineItems}" var="LIs" width="100%" border="1px" >
<apex:column headerValue="Line Item" value="{!LIs.Description}" headerClass="tableHead"/>
<apex:column headerValue="Quantity" value="{!Quantities}"/>
<apex:column headerValue="Unit Price" value="{!LIs.UnitPrice}"/>
<apex:column headerValue="MRC" value="{!LIs.Total_MRC__c}"/>
</apex:dataTable>
  

Hi.

 

I am getting the following error on a vforce page I am trying to create

 

Save error: Unknown property 'VisualforceArrayList.Description'

 

and I have no idea why.  I have treid using a list, and not using a list.  I have tried everything I can think of, but nothing seems to help.    Any help is much appreciate so thank you in advance.

 

Here is the relevant parts  of the controller class

 

public with sharing class Controller_QuotePage {
   public Quote qt {get; set;}
   public List<QuoteLineItem> theLineItems {get; set;}
   public Controller_QuotePage(ApexPages.StandardController controller) 
   {
       Id quoteID = ((Quote) controller.getRecord()).Id;
       loadQuote(quoteId);
       loadQuoteLineItems(quoteId);
    }
 	
    public List<QuoteLineItem> getLineItems(){
		 
		 return theLineItems;
    }
	

   private void loadQuote(String quoteId) {
        this.qt = [Select Id,  Site_Address__c,       
                  CreatedDate,ExpirationDate FROM Quote where    
                  Id=:quoteId];  
      
   }
    
   private void loadQuoteLineItems(String quoteId) {

       this.theLineItems = [SELECT Id, Description, Quantity, UnitPrice,
	     	            TotalPrice,Total_MRC__c,   Total_NRC__c    
                             FROM QuoteLineItem WHERE QuoteId =:   
                             quoteId];	
	   		
    }


}

 

 

And here is the relevant parts of the visualforce page

 

 

<apex:page standardController="Quote" renderAs="pdf"
	extensions="Controller_QuotePage">

<apex:dataTable value="{!LineItems}" var="LineItems">
<apex:column headerValue="Line Item" value="{!LineItems.Description}"/>
</apex:dataTable>


</apex:page>

 

 

 

Need salesforce.com consultants local to Denver.  Must be available immediately.