0

I'm trying to Suppress the Case assignment rule when case get create by LiveHelpNow Chat App. Also though the same Trigger i'm trying to assign the case to the LiveHelpNow Agent Name to i've captured into a Case.Case_Owner__c custom field and matched against the Salesforce slandered User object. Unfortunately i'm unable to disable the case assignment rule and case keeps getting assigned to The Queue by the assignment rule. I need the Case assignment rule because we also have web to case that we like those cases to be assigned to a Queue, so turning off Case assignment rule is off the table. Any Help Please.

trigger LiveHelpReAssign on Case (before insert)
{
    Map<String, Id> ownerUser = new Map<String, Id>();
    for(Case record : Trigger.new)
    {
        if(record.Case_owner__c != record.Owner.Name)
        {
            ownerUser.put(record.Case_owner__c, null);
        }
    }
    for(User record:[select Name 
                     From User 
                     Where Name IN :ownerUser.keyset()]) 
    {
        ownerUser.put(record.Name, record.Id);
    }
    for(Case record : Trigger.new)
    {
        Database.DMLOptions dmo = new Database.DMLOptions();
        dmo.AssignmentRuleHeader.useDefaultRule = false;
        record.OwnerId = ownerUser.get(record.Case_owner__c);
        record.SetOptions(dmo);
    }
}

enter image description here

  • What are the criteria defined in the Case assignment rule? – Santanu Boral Jul 17 '16 at 2:09
  • Case.Type = Contact us – Templar Jul 17 '16 at 2:10
  • Can you put picture of assignment rules? – Santanu Boral Jul 17 '16 at 2:11
  • did add the screen shot of the assignment rule. – Templar Jul 17 '16 at 2:22
  • already answered just before seeing the screenshot – Santanu Boral Jul 17 '16 at 2:24
0

There are different ways we can create cases and those can be handled and properly assigned to the queue or himself based on assignment rules.

You can define Case Origin picklist values as follows:

  1. Email-to-Case, Origin = 'Email'
  2. Web-to-Case, Origin = 'Web'
  3. Live Agent, Origin = 'Chat'

Also, you can define different recordTypes based on criteria (including Origin).

In the Case assignment rule, you can verify Origin or recordtype or other criteria and assign the cases to different owner.

If no criteria is matching, then you can assign the Case to the same user/Admin/specific user/queue.

Updating answer for userDefaultRule

If specified as true for a case or lead, the system uses the default (active) assignment rule for the case or lead. If specified, do not specify an assignmentRuleId.

Usage

If there are no assignment rules in the organization, in API version 29.0 and earlier, creating a case or lead with useDefaultRule set to true results in the case or lead being assigned to the predefined default owner. In API version 30.0 and later, the case or lead is unassigned and doesn't get assigned to the default owner.

Workaround

Do not stop assignment rule. Rather than using trigger, you can use process builder to update the case owner for Chat origin cases. Process builder runs after Case assignment rules, Hopefully it helps.

  • I'm already Capturing the User into Case.Case_Owner__c custom filed and my code is matching that against the Standard User object. I just need to disable the Case Assignment rule for cases being created by LiveHelpNow – Templar Jul 17 '16 at 2:39
  • You can define an case origin as 'Chat' for those cases created by LiveHelpNow . Do not need to disable assignment rule – Santanu Boral Jul 17 '16 at 2:42
  • I've changed the Case Assignment Rule to "Case Origin not equal Chat" yet the rule still runs. – Templar Jul 17 '16 at 2:54
  • Assignment rule will always run if that it is active, check the updated answer and handle your scenario. – Santanu Boral Jul 17 '16 at 3:05
  • that is why in my code i try to turn off the case assignment rule for case created by LiveHelpNow. Also i do need the case assignment rule on to assign the non-chat cases to a Queue. – Templar Jul 17 '16 at 3:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.