You need to sign in to do that
Don't have an account?
Venkateshwarrao Admin
Trigger example
Hai,
Q) i have two standard objects Account and Contact,Requirment is Display the Count of Contact on account obj by using custom field Count_of_con. trigger have write. anyone send the code.advanced thanks
Q) i have two standard objects Account and Contact,Requirment is Display the Count of Contact on account obj by using custom field Count_of_con. trigger have write. anyone send the code.advanced thanks
Use the rollup summary that is the easiest way to achieve it.
https://help.salesforce.com/apex/HTViewHelpDoc?id=fields_defining_summary_fields.htm&language=en (https://help.salesforce.com/apex/HTViewHelpDoc?id=fields_defining_summary_fields.htm&language=en)
https://help.salesforce.com/apex/HTViewHelpDoc?id=fields_about_roll_up_summary_fields.htm&language=en_US (https://help.salesforce.com/apex/HTViewHelpDoc?id=fields_about_roll_up_summary_fields.htm&language=en_US)
Let me know if you face any issue.
Don't forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can helpn
There is no need for writing code if there is Master Detail relationship between Account and Contact. You can create a new roll up summary field on Account that counts the number of child Contact records.
Thanks
AR
If this solves your problem then please mark it as best answer.
- Apex Code - Take look into the Declarative Roll-up tool, which can be used for easily for any other object - https://developer.salesforce.com/page/Declarative_Rollup_Summary_Tool_for_Force.com_Lookup_Relationships
- VisualFlow - You can alsoo implement Roll-up summary field for lookup relation without writing apex code. You can use the implement the logic using visualflow. Take a look into this blog post for the step by step instructions https://mindfiresfdcprofessionals.wordpress.com/2013/09/11/roll-up-summary-fields-with-lookup-relationships/
Thanks,Karanraj