You need to sign in to do that
Don't have an account?
Mugdha Ralegaonkar
case assignment rule is getting fired when case comment is added from API
We have setup assignment rules and also setup default case owner from support settings. We are adding case comments through REST API call from external system and whenever case commet is added, it is resetting the case owner of the case by firing the assignment rules. If an agent has aready taken ownership of the case , when comment is added that ownership goes back to the queue as per the assignment rules and it is not helpful. I learnt that whenever API call takes place it fires assignment rules thats how salesofrce works. So, 1. first workaround we tried creating a checkbox, setting it to false by default and adding condition in the assignment rule saying run the rules only when checkbox is false. And we are sending the checkbox vale as true ONLY when comment is added from the API so that way assignment rules won't work. --> It did not work, although the value is coming as true, assignment rules still fires (As per sfdc standard behaviour) and it doesnt meet any of the rule criteria so it assigns default case owner defined in support settings.
second workaround we tried is uisng the trigger before inserting the case comment and setting the rule to false using below code. after activating the trigger, and testing the scenario.. the owner is still getting replaced when comment is added. Any suggestion would be of GREAT HELP!!
trigger test on CaseComment (before insert) {
List cc = new list();
for (CaseComment cd : Trigger.new) { Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule = false; cd.setoptions(dmo); cc.add(cd); }
insert cc; }
Thanks!!
second workaround we tried is uisng the trigger before inserting the case comment and setting the rule to false using below code. after activating the trigger, and testing the scenario.. the owner is still getting replaced when comment is added. Any suggestion would be of GREAT HELP!!
trigger test on CaseComment (before insert) {
List cc = new list();
for (CaseComment cd : Trigger.new) { Database.DMLOptions dmo = new Database.DMLOptions(); dmo.assignmentRuleHeader.useDefaultRule = false; cd.setoptions(dmo); cc.add(cd); }
insert cc; }
Thanks!!
All Answers
How should I use Sforce-Auto-Assign: FALSE in the code?
I am not expert in writing triggers yet, so had to ask.
HttpPost httppost = new HttpPost(environmentId + "/services/data/v33.0/sobjects/Case/"+ caseId);
httppost.setHeader("Sforce-Auto-Assign", false);
Is this will work ?
Thanx