Apex is not the only technology in Salesforce that can access your data or manipulate it. Apart from Apex, there are multiple declarative tools available in Salesforce which can read your data or manipulate it.
These declarative tools are also called the point and click tools or wizard-based tools because you do not have to write any code to use these. However, you need your problem-solving ability to write your logic in these tools.
Now, let’s Let discuss these declarative tools one by one.
Workflow Rules:
The first one is Workflow Rule as it has been part of the Salesforce platform for many years and this is one of the most mature tools available on the Salesforce platform right now.
If you go back 10 years, the Workflow Rule was the only available automation tool at that time.
These Workflow Rules can have multiple actions, like sending an e-mail or sending an outbound message or creating a task, or updating the self-record where the workflow Rule is executing or the parent record, but it doesn’t allow the child’s record update.
So, that means if your Workflow Rule is executing on a parent object, you cannot update the related child record on that parent record. So, that was the limitation of the Workflow Rule. This Process flow tool is retiring very soon as Salesforce is already announced and recommend not to use Workflow Rules and use flow instead.
Process Builder:
After some time, Salesforce introduced one more declarative tool, which is called Process Builder. It supports many types of actions, like all the actions in the workflow rule except the outbound message, it cannot send an outbound message, but it can send an email. It can create a task or any type of object record for that matter. So, you can create any type of record using Process Builder.
It can also update the record, the parent record, or the child record. So, Process Builder supports all types of record updates, but these records should be related to each other. So, either this record that you want to update should be the self-record where the process builder is executing, it should be the parent record, or it can be the child record. The Process Builder can also execute your Apex class through you can do customization and write your own business logic. So, you can have your logic in your Apex class and can directly call it from the Process Builder.
A Process Builder can have multiple steps, unlike Workflow Rule. So, in one single Process Builder, you can have your entire logic using different if-else conditions or using different steps.
However, the Process Builder does not support deleting a record. So, if you want to delete a record, the Process Builder is not the right tool for you. And, if you want to update the unrelated records, so, this means if you have two different objects, which do not share any kind of relationship and you have a Process Builder on one of the objects, then you cannot update the records of the other object from the Process Builder. Process builder is a modern tool and advanced Workflow Rules, but it’s also outdated and has limited functionalities so Salesforce also recommends using Flows Instead.
Visual Flow:
The last and the most powerful declarative tool available in Salesforce is the Visual Flow.
A Visual Flow can do so much more than what a Workflow Rule or a Process Builder can do. And it can execute your Apex classes, it can execute your lightning components as well, you can design your screens using Visual Flow, and you can almost write all types of logic in Visual Flow, so, it’s very similar to how you write your Apex code. You can declare your variables here. You can also declare certain methods that you can call from Visual Flow. But it comes with its own cost. The execution of a Visual Flow is slower than Apex. So, let’s say if you have similar logic in your Visual Flow and in Apex class, then your Apex class will execute faster than the Visual Flow. The debugging of Visual Flow can be challenging sometimes, and it’s not that easy to debug the errors in your Visual Flow. So, I won’t say that Visual Flow is a declarative tool, what I will call it is a low code development tool where you don’t have to write that much amount of code that you write in your Apex class. So, it’s fair to say that Visual Flow is by far the most powerful declarative tool and you can do almost everything in Visual Flow but still, it cannot match the power of Apex code. For some complex requirements, implementing a Visual Flow can be very challenging compared to writing an Apex code. So, these are the declarative tools available in Salesforce. In this course, our main focus would be to learn Apex and write Apex code. So, we will not be implementing any of these declarative tools.
If you have any questions, please comment, and reach me at yousuf@infotechabout.com