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
Venkateshwarrao AdminVenkateshwarrao Admin 

Trigger example

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
Mudasir WaniMudasir Wani
Hey Venkateshwarrao,

Use the rollup summary that is the easiest way to achieve it. ( (

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
Anupam RastogiAnupam Rastogi
Hi Venkatesh,

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.


If this solves your problem then please mark it as best answer.
Hi  Venkateshwarrao - The standard Account and Contact are not master detail relationship so you can't have rollup summary field. There are two ways to implement the rollup-summary for the Lookup relationship Thanks,
Venkateshwarrao AdminVenkateshwarrao Admin
Yeah, But when we select the object while creating Rollup summary on account it not shows the contact.its show only oopurtunity object. so we have to write the trigger i thought... Please once try it if any result send back