Cancel a workflow using a script when any one of RITM approvals are rejected | ServiceNow

Use the following script in the run script activity of the current workflow answer = true; var sag = new GlideRecord(‘sysapproval_group’); sag.addQuery(‘parent’, current.sys_id); sag.query(); while(sag.next()) { if(sag.approval == ‘rejected’) { current.state = ‘4’; var w = new Workflow(); var gr = new GlideRecord(‘wf_context’); if (gr.get(current.context)) w.cancelContext(gr); } }