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
Akshay ShrivastavaAkshay Shrivastava 

how to avoid recursion : one field is update by process builder and same field is update by trigger.

Best Answer chosen by Akshay Shrivastava
SwethaSwetha (Salesforce Developers) 
A similar issue has been reported by a user from past- https://salesforce.stackexchange.com/questions/138247/how-to-prevent-process-builders-to-fire-triggers-on-an-update according to which, the solution is using some custom settings or using a helper class that would enable the execution of the trigger one time and that would become inactive after the execution. This would guarantee that your trigger is only being executed once.

Detailed code mentioned in the above link. It is also worth checking the order of execution mentioned in https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm to design your implementation accordingly and to avoid hitting governor limits.

Related posts:
https://salesforce.stackexchange.com/questions/296307/recursive-record-update-by-flow
https://salesforce.stackexchange.com/questions/252558/recursion-in-trigger-and-process-builder
https://salesforce.stackexchange.com/questions/256444/prevent-recursion-cpu-limit-in-process-builder
https://salesforce.stackexchange.com/questions/317560/process-builder-and-flow-resulting-in-recursion

If this information helps, please mark the answer as best.Thank you

All Answers

SwethaSwetha (Salesforce Developers) 
A similar issue has been reported by a user from past- https://salesforce.stackexchange.com/questions/138247/how-to-prevent-process-builders-to-fire-triggers-on-an-update according to which, the solution is using some custom settings or using a helper class that would enable the execution of the trigger one time and that would become inactive after the execution. This would guarantee that your trigger is only being executed once.

Detailed code mentioned in the above link. It is also worth checking the order of execution mentioned in https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm to design your implementation accordingly and to avoid hitting governor limits.

Related posts:
https://salesforce.stackexchange.com/questions/296307/recursive-record-update-by-flow
https://salesforce.stackexchange.com/questions/252558/recursion-in-trigger-and-process-builder
https://salesforce.stackexchange.com/questions/256444/prevent-recursion-cpu-limit-in-process-builder
https://salesforce.stackexchange.com/questions/317560/process-builder-and-flow-resulting-in-recursion

If this information helps, please mark the answer as best.Thank you
This was selected as the best answer
Ashvin JAshvin J
Hi Akshay, 

As per best practice you should only keep one approach here. See if you could manage the field update from Process Builder to work in a Trigger where same field is getting updated. 

Thanks,
Ashvin