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
Arpit Jain92Arpit Jain92 

Problem in Trigger

Hello,

I have a custom field on account, I want to updated that field with the latest contact name using trigger and the name of the contact is same as account name with some other values. like Account name is-ABC then contact name will be like ABC1, ABC2, ABC3. Pls help me out.

Thank You.
Arpit
Abhishek BansalAbhishek Bansal
Hi Arpit,

You can follow the below steps :
1. Write a trigger on Contact object
2. In this trigger query the related account with child contacts in inner query
3. Based on the count of child contacts you can set the name of your current contact. For Eg : currentCon.Name = acc.Name + acc.childContactList.size() + 1;
4. Now update the custom field on the related account with the name of your current contact.

Please let me know if you need more help or information on this.

Thanks,
Abhishek Bansal