What is Process Builder?

By | salesforce | No Comments

When I was looking at Process Builder, immediate thought that struck me was that “this tool will replace Workflow Rules and Visual Workflow”, but with a deep dive into it, I knew that I was taken by surprise, “it’s not meant to be a replacement, it’s a complementary feature to the existing tools”. Below table clearly summarizes that it was not going to replace other similar tools mentioned before, rather it will deem an Administrator ‘more capable’ of doing things that were previously dependent on Developers alike.

Let’s look at the comparison table (source: click here):

Image - 1As it turns out, Process Builder is (another) automation tool that helps you easily define your business processes by providing a powerful and user-friendly graphical representation of your processes as you build them. The Process Builder’s simple and powerful design allows you to:

  • Create your processes using a convenient layout with point-and-click efficiency
  • Create your whole process in one place rather than using multiple workflow rules
  • Create processes by collaborating with different teams in your business
  • Stop using Apex code to automate simple tasks

However, the most interesting aspect of Process Builder is the ability to call Apex class; with this capability, there are many (more) competencies that can be introduced easily; without relying on and complicating the existing Apex Triggers that are already giving enough problems (if not designed/coded right).

Mock Scenario (and how I set it up on Process Builder)

I have come up with a use case of creating 4 mandatory Tasks whenever an Account that has >250K in assets is being created (or updated to have minimum 250K in assets – see below screenshot: label #2).  Out of this 4 Tasks, the last (4th) Task is basically a redundant “reminder Task” to check the first 3 Tasks.

Here is what I expect to do with Process Builder (with calling Apex Class):

  • Use the Process Builder declarative functions to create all 4 Tasks, then mark the field Mandatory Tasks Created as true (see below screenshot: label #1)
  • Call Apex Class to delete all 4 Tasks for Account that was updated to have less than 250K (note: Delete action is not supported on Process Builder)
  • Call Apex Class to delete only the 4th Task if a checkbox (First 3 Tasks completed) is set to true (see below screenshot: label #3)

Image - 2 Image - 3Setup Process Builder

Process Builder can be reached through: Create >> Workflow & Approvals >> Process Builder

Process builder - Setup

As soon as you click the link, you will be presented with the UI where you can find the “New” button on the right, click the “New” and name your Process:

Image - 5

I called my process:

X01_AccountCU_Create_Follow_Up_Tasks_for_Client_with_250K_in_Assets; “quiet long eh!” however it describes what the use case intends; create your own convention or possibly follow your current existing convention (for naming Classes, Triggers, Flows, etc.)

Here is how it looks like on mine:

Image - 6

As you perform each action such as Create Record, Update Field; a specific setup screen will be presented to you to fill in the required information/details.

Here is the screen when creating a record (Task #1):

Image - 7

Here is the screen when updating a field (Mandatory Tasks Created as true):

Image - 8

Here is the screen when calling Apex Class (to delete All Mandatory Tasks):

Image - 9

** Please note that all the fields are greyed out because the screenshot was taken on read-only mode.

Calling Apex Class

 More specifics on calling Apex Classes: Salesforce has introduced 2 annotations to support the call. It’s @InvocableMethod and @InvocableVariable; you will find more information here link.

Please note that I’m using a list of user-defined type for this example.

Here is what the Class looks like (you can relate back to the screenshot above – calling Apex Class):

 public class DeleteTasks { 
       public class DeleteTasksRequest { 
        @InvocableVariable(label='Only Task04' required=true) 
        public boolean task04Only; 
        @InvocableVariable(label='Account Id' required=true) 
        public Id accountId; 
 @InvocableMethod (label='Delete Tasks' description='Delete Tasks based on provided Account Id List') 
    public static void DeleteTasksUsingAccountIdList(List<DeleteTasksRequest> dtrList) { 
        List<Id> accountIdTask04List = new List<Id>(); 
        List<Id> accountIdAllTaskList = new List<Id>(); 
        List<Task> tasksToDelete = new List<Task>(); 
        for (DeleteTasksRequest dtr: dtrList) { 
            if (dtr.task04Only){ 
            else { 
        // Only Task 04 
        if (accountIdTask04List.size() > 0 ) { 
            for (Task task : [select id from Task where whatId in :accountIdTask04List and Subject LIKE 'Task 04%']) { 
       // All Tasks for the Account Id 
        if (accountIdAllTaskList.size() > 0 ) { 
            for (Task task : [select id from Task where whatId in :accountIdAllTaskList and Subject LIKE 'Task 0%']) { 
        // Only delete if there are contents to Delete 
        if (tasksToDelete.size() > 0)  { 
            delete tasksToDelete; 


Breakdown of important aspect on the class:

Image - 10

  • #A: This is the Class name, the same information that you will select on the Process Builder
  • #B: This is inner class for the user-defined type
  • #C: This is @InvocableVariable annotation; the label (Only Task04) is what shown on Process Builder
  • #D: same as #C; for Account Id
  • #E: The method marked with @InvocableMethod annotation; note that there’s only one method that you can mark with this annotation in a Class.

Closing Notes

 Process Builder is another tool; a very useful tool depending on how/where it is being used. One of the obvious possibilities is to replace the logic currently coded in triggers. These logics can possibly be replaced with Process Builder (with calls to Apex Classes), giving the capability/flexibility to change rigid process logic back in to the hand of Administrators.

By Tahimin Tjhia

Analytics Cloud – The 1st Canadian Wave Analytics Implementation!

By | analytics cloud, business intelligence, salesforce, wave analytics | No Comments

Mastering Mobile Header

It took awhile for Analytics Cloud to find a customer in Canada but Stratus360 is immensely proud to have been the partner for the first implementation.  I’ll be covering what we were able to accomplish in a later post but for now I want to briefly highlight what Analytics Cloud is, and why I think it’s a great tool for your organization.
Read More