Pages

Thursday, May 1, 2014

Why Salesforce assignment rule is not working?

After involve and active in Salesforce Success Answers Community for many years, I see many users confused and question why my assignment rule is not working?

In my previous blog, I discuss the case or lead assignment using the active assignment rule and how to set it to default in page layout.

Here a few steps to troubleshoot:

1. Check the assignment rule is Active
Only one assignment rule can be active at one time in both Case and Lead.

2. Try to create the record manually in the Salesforce web user interface
Check if the record is assigned to the correct user/queue and make sure checkbox Assign using active assignment rule is selected.

To support step 2, things you can do:
- Enable Field History Tracking on Case Owner
- Add object History in page layout (Case History or Lead History)

If the assignment rule is working, you should see in history related list:

And compare with if the Lead owner is changed manually:

Can you spot the difference?

3. Assignment Rules work only for a specific scenario
  • Lead Assignment Rules — Specify how leads are assigned to users or queues as they are created manually, captured from the web, or imported via the lead import wizards.
  • Case Assignment Rules — Determine how cases are assigned to users or put into queues as they are created manually, using Web-to-Case, Email-to-Case, On-Demand Email-to-Case, the Self-Service portal, the Customer Portal, Outlook, or Lotus Notes.

Using the Import Wizard
Select assignment rule in Step 1, even the assignment rule is not active, you can select it and it will work.


Using Data Loader
In the Settings menu, enter the Assignment Rule Id into the Assignment rule check box, remember not Assignment Rule Name. You can retrieve the Id from Salesforce URL when you open the assignment rule, for example, https://na3.salesforce.com/setup/own/entityruledetail.jsp?id=01Q50000000Iiz4&setupid=LeadRules



If you use other API tools that not provide Assignment Rule setting,  Lead / Case created simply will not have assignment rule kick-in.

If you are using API or APEX code, you can retrieve the Assignment Rule Id and use it when creating Lead or Case, here a simple snippet:

//Fetching the assignment rules on Case
AssignmentRule AR = new AssignmentRule();
AR = [SELECT Id FROM AssignmentRule WHERE SobjectType = 'Case' AND Active = True LIMIT 1];

//Creating the DMLOptions for "Assign using active assignment rules" checkbox
Database.DMLOptions dmlOpts = new Database.DMLOptions();
dmlOpts.assignmentRuleHeader.assignmentRuleId= AR.id;

Case newCase = new Case(Status = 'New') ;
//Setting the DMLOption on Case instance
newCase.setOptions(dmlOpts);
insert newCase ;


TIPS: Salesforce processes rules in the following order:
  1. Validation rules
  2. Assignment rules
  3. Auto-response rules
  4. Workflow rules (with immediate actions)
  5. Escalation rules


Reference:


No comments:

Post a Comment