Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

On-call scheduling functionality: trigger rules will not work if the assignment_group is exist

ShreeyaSatam
Tera Contributor

Hi Team,

We are on Zurich release.
The On-call scheduling functionality, trigger rules will not work if the assignment_group is exist on the incident

We have created trigger rule which works when incident created without assignment group, however it is not working if incident created with assignment group on.
We are using On-Call: Assign by Acknowledgement workflow on trigger rule.
If anyone recently created custom solution to work this scenario then can someone assist me to resolve this issue?
I have created below business rule on the incident table

(function executeRule(current, previous /*null when async*/ ) {

// if (current.u_oncall_processed == true) {
// return;
// }

var triggerRuleGR = new GlideRecord('trigger_rule');
triggerRuleGR.addEncodedQuery('table=incident^trigger_workflow=78d9b342ff010200f6d6ffffffffff9d^active=true'); // On-Call: Assign by Acknowledgement
triggerRuleGR.query();

var logStr = '';

while (triggerRuleGR.next()) {

var condition = triggerRuleGR.condition.toString();
var match = GlideFilter.checkRecord(current, condition);

logStr += 'Trigger Rule: ' + triggerRuleGR.name + ' | Condition: ' + condition + ' | Match: ' + match + '\n';

if (match) {

// Start the workflow BEFORE updating the record
var wf = new Workflow();
var inputs = {
groupid: current.assignment_group.toString(), // <-- workflow input
// journal_field: 'work_notes' // example input you use later
};

var wfsysid = wf.startFlow(
'78d9b342ff010200f6d6ffffffffff9d', //workflow On-Call: Assign sysid
current,
current.operation(),
inputs
);

logStr += 'Workflow started: ' + wfsysid + '\n';

// Now update the record to set u_oncall_processed = true
// current.u_oncall_processed = true;
// current.setWorkflow(false);
current.update();


gs.info('' + logStr);

}
}

})(current, previous);


I was following this community thread
https://www.servicenow.com/community/developer-forum/on-call-trigger-rules-and-assignment-group-issu...

1 REPLY 1

ShreeyaSatam
Tera Contributor

It is working as expected with some changes in the script