How to set other approver state to 'No longer required' if one Approver approved the CTASK

saran raj
Tera Contributor

Hi,

A CTASK has a group approval where all the members in the group should approve or group approval should be provided, but the user is requesting to make approval - No longer required if any user in the group approves it. A run script is configured to create a standard change. How can I achieve this by modifying in the run script. Below is the script for reference. Please guide me to set other approver state to 'No longer required' if one Approver approved.

 

var template = new GlideRecord('std_change_producer_version');
//Firewall template
template.get('std_change_producer', '2df0e45147a4ddd4ff96ebbd436d43ae');
template.orderByDesc('sys_updated_on');
template.setLimit(1);
template.query();
 
 
while(template.next())
{
 
var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'standard';
chg.category = 'Enhancement';
chg.std_change_producer_version = template.sys_id;
chg.applyTemplate(template.std_change_producer.name);
chg.start_date = new GlideDateTime(current.variables.start_deploy_date);
chg.end_date = new GlideDateTime(current.variables.end_deploy_date);
chg.parent = current.sys_id;
chg.assignment_group.setDisplayValue('Network.Operations.GLBL.IM.SUP');
chg.opened_by = current.opened_by;
chg.requested_by = current.opened_by;
chg.comments = current.comments.getJournalEntry(-1);
chg.u_service_catalog_source = '2df0e45147a4ddd4ff96ebbd436d43ae'; //Firewall
chg.u_request_type = 'Firewall Change Request';
chg.short_description = current.short_description;
chg.description = current.description;
 
var change = chg.insert();
 
GlideSysAttachment.copy('sc_request', current.getUniqueValue(), 'change_request', chg.getUniqueValue());
var chgtask = new GlideRecord('change_task');
chgtask.initialize();
chgtask.u_type = 'Validation';
chgtask.assignment_group = '75dbecd0606e4100a210b5d776ef5aa0';
chgtask.parent = change;
chgtask.short_description = "[Validation Task]" + chgtask.parent.number.getDisplayValue() + ':' + current.short_description;
var change_task = chgtask.insert();
var approver = new GlideRecord('sysapproval_group');
approver.parent = change_task;
approver.assignment_group = '75dbecd0606e4100a210b5d776ef5aa0';
approver.approval = 'requested';
approver.insert();
}
 
8 REPLIES 8

Create a flow or workflow with a trigger condition matching the task you are creating on the change_task table then have that use the approval group activity to generate the approval

Hi @John Dewhurst

You mean, should I create a separate workflow and trigger matching the condition on change_task then add approval activity?

Hey Raj, Yeah exactly.

Hi @John Dewhurst 

Let me try and update you! Thank you!