You need to sign in to do that
Don't have an account?
Staci
invoke assignment rule with javascript button
I'm making an escalate case button for our customers to use. I need the funtionality to assign the case to a generic support queue if a checkbox is true, if not I need it to assign the case to the corresponding partner queue, which are set in the case assignment rules. Is there a way to invoke the assignment rules in the javascript button?
{!REQUIRESCRIPT("/soap/ajax/13.0/connection.js")} var caseObj = new sforce.SObject("Case"); caseObj.Id = '{!Case.Id}'; if('{!Case.CW_Advance_Support_Needed__c}' == true) { caseObj.OwnerId = '00G30000001oUSL'; caseObj.Status = 'In Progress'; }else{ caseObj.CW_Advance_Support_Needed__c='True'; caseObj.Escalated_Date_Time__c=new Date().toJSON(); } if('{!Case.Incident_First_Response__c}'=='') { caseObj.Incident_First_Response__c=new Date().toJSON(); } var result = sforce.connection.update([caseObj]); window.location.href=window.location.href;
https://developer.salesforce.com/docs/atlas.en-us.ajax.meta/ajax/sforce_api_ajax_headers.htm?search_text=assignment
Sample code
https://salesforce.stackexchange.com/questions/93027/javascript-to-use-an-assignment-rules-on-a-case
The If part is assigning the cases fine. The else is not using the case assignment rules. Any other suggestions?
sforce.connection.assignmentRuleHeader = { "useDefaultRule": "true" };
I got this from https://salesforce.stackexchange.com/questions/195562/run-assignment-rule-from-javascript-button. As that post says, if the quotes around "true" don't work for you, try omitting them. I did not need to, but just in case...