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
Karla Pliego 3Karla Pliego 3 

apex code and validation rules

I have a developer who wants to create apex code to allow some validation rules to take place in an object that is related to another. Right now we have a process builder that is conflicting somehow with the validation rules. He's saying that in order for the rules to work he wants to build apex code to put the process builder into it and avoid this conflict. Does anyone have any info on what he's talking about? Not an apex expert and I'm trying to understand why he needs it to avoid the conflicts with process... he said it has something to do with the calculations that are not right to be used with process and need to be done with coding. 
Sudipta DebSudipta Deb
Hi,

There are some limitations on process builder as mentioned in the below link -
https://help.salesforce.com/articleView?id=process_limits.htm&type=5

I think your developer is trying to replace Process Builder functionality with Apex code.There is no harm in doing that. But your developer needs to make sure (or at least try to) that there is no Process Builder and Trigger on the same object. Having Process Builder and Trigger on the same object have direct impact on performance. So your developer should justify why both process builder and trigger are necessary on the same object.

I have written a blog post to discuss few key areas which can help you/your developer to choose between Trigger and Process Builder -
How to choose between Trigger and Lightning Process Builder (http://www.sudipta-deb.in/2016/10/how-to-choose-between-trigger-and.html)

I hope this will help you.

Note - Please accept my solution as Best Answer if my reply is helpful.