You need to sign in to do that
Don't have an account?
Raksha Tiwari 8
Update account status according to status of all related contacts
Hi All,
I have a requirement in which account status should be updated if its all related contacts have same status. I have three status values in contact, 'New', 'In progress' and 'Cancelled'. Suppose an account A has three related contacts C1, C2 & C3. If the status of all three contacts is 'New', then account's status should be 'New'. Can anyone help me out on this?
Regards,
Raksha
I have a requirement in which account status should be updated if its all related contacts have same status. I have three status values in contact, 'New', 'In progress' and 'Cancelled'. Suppose an account A has three related contacts C1, C2 & C3. If the status of all three contacts is 'New', then account's status should be 'New'. Can anyone help me out on this?
Regards,
Raksha
I will suggest you to start learning Trigger from Trailhead . (https://trailhead.salesforce.com/modules/apex_triggers)
Start Writing your code and post the issue if you got any.
Your trigger will simple. Try to follow below step
1) Write Trigger on Contact
2) Create on Set and add accountID in same
3) then Query all Account and contact like below 4) Then add your custom logic to check contact status and update account status.
Let us know if this will help you
here is your trigger it is working fine in my org
In this trigger i create a picklist in contact name : Contact_Status__c (api name)
and another picklist in account object : Account_Status__c (api name)
if this was helpful please mark as best answer else let me know
Thank you
Avaneesh Singh