Using Salesforce Assignment Rules
September 14, 2020
While Salesforce’s assignment rules allow for record assignments to be taken care of with ease, they suffer from one big pitfall. Current Salesforce functionality allows for assignment rules to be run when a record is created. But this does not allow for the freedom to choose the exact moment to have those rules trigger. They do not allow you to re-run them when specific criteria is met. Record values can quickly change, and having rules run when created or edited may not always suit your requirement.
Also, when you create records via Lightning quick actions - Salesforce does not allow for assignment rules to be triggered for records created this way.
Salesforce Assignment Plugin
This is where the Salesforce Assignment Plugin opens that functionality up for you. With the Assignment Plugin, you can trigger assignment rules as often as necessary directly from process builder, flow, or custom code.
Here, we show how Lead assignment rules can be re-triggered, using the Assignment Plugin, when the Lead’s Pardot Score goes above 50.
First, download the Assignment Plugin from the App Exchange. This can be downloaded here.
Once that is done, you can add it to your process builder.
Create a new process builder node and add your criteria. Ours is very simple, it triggers once the Pardot Score field is above 50.
Next, in your process builder action, choose Apex. From the dropdown list of Apex classes find the “Run_Assignment” options. Note the different classes that can be chosen:
- Invocable_StandardAssignment - executes your assignment rules in an immediate action
- Invocable_StandardAssignmentV2 - executes your assignment rules immediately and allows you to trigger the email notifications configured within your assignment rules
- Invocable_StandardAssignmentFuture - executes your assignment rules as a scheduled action
- Invocable_StandardAssignmentFutureV2 - execute your assignment rules as a scheduled action and allows you to trigger the email notifications configured within your assignment rules
For our process, we use the Invocable_StandardAssignmentV2.
Call Apex
The variables for the invocable class are as follows:
- triggerUserEmail - allows for emails to be sent to users within your org
- triggerAutoResponseEmail - allows for auto response triggers to run during the assignment
- triggerOtherEmail - allows for emails to be sent outside of the org
- recordId - a reference to the record’s id
Since we are not triggering any emails in our process, we also could have used the Invocable_StandardAssignment class.
Lead Records Automatically Routed
You can now save and activate your process. Now, whenever your Lead’s Score increases to above 50, your assignment rules will calculate as per their criteria and your Lead record will automatically be routed to the correct owner.
You can utilize this plugin with a wide range of processes and can even use it within your flow to get the full extent.