function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Debbie OliverDebbie Oliver 

Creating a Total in Related List

Hi I am trying to add a total to a related list and struggling with this, Is there a way to do this in a visual force page?
Best Answer chosen by Debbie Oliver
Shalom RubdiShalom Rubdi
Also, not sure of your level of familiarity with Visualfoce, but here is an example of how you could refer to your 'Total Units' custom field: 
 
​<apex:outputField value="{!opportunity.Total_Units__c}"/>

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_outputField.htm

All Answers

Shalom RubdiShalom Rubdi
Hi Debbie - yes, you can adjust the what's displayed in the header of the related list:

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_relatedList.htm
Debbie OliverDebbie Oliver
Thank you for responding, but how do you created the total field, for example I have # of units fields  and it is listed for 5 different entries the user wants to see the total line below

Plan A 1
Plan B 2
Plan C 3
Total    6
 
Shalom RubdiShalom Rubdi
Configure a roll-up summary field, e.g. 'Total Units', that counts the number of related records.  Then put in a reference to 'Total Units' in the related list header.

https://help.salesforce.com/HTViewHelpDoc?id=fields_defining_summary_fields.htm
Shalom RubdiShalom Rubdi
Also, not sure of your level of familiarity with Visualfoce, but here is an example of how you could refer to your 'Total Units' custom field: 
 
​<apex:outputField value="{!opportunity.Total_Units__c}"/>

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_outputField.htm
This was selected as the best answer
Debbie OliverDebbie Oliver
Thank you for all your help. I am very new to all of the visual force.
Shalom RubdiShalom Rubdi
Thanks Debbie - if any of these helped you please mark one of them as 'Best Answer' so this can be flagged as 'Solved'.

Best of luck!
Debbie OliverDebbie Oliver
I do have one last question, so I created the roll up and field just fine, but when you create the visual force page how do you create the column so it displays as I showed above where the total displays below?