Business rule not trigger
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2024 11:49 PM
For below Business rule script , BR not triggering the first time ticket assignment
,
(function executeRule(current, previous /*null when async*/) {
var wflw = new Workflow();
var gru = GlideScriptRecordUtil.get(current);
var changedFields = gru.getChangedFields(); //Get changed fields with friendly names
// var changedValues = gru.getChanges(); //Get changed field values
gs.include('j2js');
changedFields = j2js(changedFields);
function isInArray(value, array) {
return array.indexOf(value) > -1;
}
if(current.operation() == "update" && current.reassignment_count > 0) {
if(isInArray("Assignment group",changedFields)){
// gs.addInfoMessage("Update");
wflw.startFlow(wflw.getWorkflowFromName('Req_Ticket_ Auto_Assignment_CSD'), current, 'update');
}
}
if(current.operation() == "insert"){
// gs.addInfoMessage("Insert");
wflw.startFlow(wflw.getWorkflowFromName('Req_Ticket_ Auto_Assignment_CSD'), current, 'update');
}
})(current, previous);
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 05:53 AM
hi @User376867 ,
I haven't tried yet but I hope you can refer this page.
I can find using "else if" instead of using "if" clause as below:
if(current.operation()=="update")
{
// do something
}
else if(current.operation()=='insert')
{
// do the other thing
}
Or,,, is it caused by wrong setting of "When to run" trigger condition?
Thanks!