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
SeksakiSeksaki 

when updating a contract update an account field

Hello,
When updating a contract I want to retrieve the list of contracts attached to this client and I check a field in at least one contract  and I update the account .
what is the best solution : process builder or trigger .. ?
Thanks for help.
Best Answer chosen by Seksaki
ANUTEJANUTEJ (Salesforce Developers) 
Hi Boudalia,

Process builder drawbacks:

>> Process Builders cannot handle before DML It executes after a record has been created or updated. Whereas Apex triggers can handle both before and after DML operations.
>> Process Builder cannot handle delete and undelete DML. Whereas Apex triggers can handle all DML operations.
>> An error reported in Process Builder is more generic which makes it difficult to find the origin of the error. With Apex triggers, exception handling can be made more specific.
>> It is all or none in the case of Process Builder failure. But with Apex triggers partial success is possible.

Although both can be used I would suggest checking if any of the above criteria would be met and in case if it meets then you can go for an apex trigger if not if it just this simple use case then you can go for a process builder.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.

All Answers

ANUTEJANUTEJ (Salesforce Developers) 
Hi Boudalia,

Process builder drawbacks:

>> Process Builders cannot handle before DML It executes after a record has been created or updated. Whereas Apex triggers can handle both before and after DML operations.
>> Process Builder cannot handle delete and undelete DML. Whereas Apex triggers can handle all DML operations.
>> An error reported in Process Builder is more generic which makes it difficult to find the origin of the error. With Apex triggers, exception handling can be made more specific.
>> It is all or none in the case of Process Builder failure. But with Apex triggers partial success is possible.

Although both can be used I would suggest checking if any of the above criteria would be met and in case if it meets then you can go for an apex trigger if not if it just this simple use case then you can go for a process builder.

Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.  

Thanks.
This was selected as the best answer
ShirishaShirisha (Salesforce Developers) 
Hi Boudalia,

Greetings!

You can achieve this in both the ways but If you would like to avoid using Code then you can go with the Process builder with flow.

Also,yes you can update multiple records using Process builder as mentioned in the below:

https://help.salesforce.com/articleView?id=000340214&type=1&mode=1

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri
 
SeksakiSeksaki
Hello,
I'm going to use a trigger, because I already have a masterdetail relationship for the parent.

Thanks