Auto Insert of Required Approvers based on Affected CI Change Approval Group

sudhakar8
Tera Contributor

Change would like 'Required Approvals' to be added to a CMR automatically, based on the 'Change Approval Group' attribute on a CI (CI criteria: it is not Non-Operational) this would include CIs that are added to both the primary affected CI variable or or those included as part of the Affected CI TAB).

This is to be applied for both change types:  Normal and Emergency (i.e NOT to Standard changes)

1 ACCEPTED SOLUTION

//Add technical approvers to the change request when a new affected CI has been added.
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('change_request');
gr.addQuery('sys_id', current.task);
gr.query();
if(gr.next())
{
var change_grp = gr.u_technical_approvers_group.toString();
if (change_grp.indexOf(current.ci_item.u_change_approval_group) < 0)
{
gr.u_technical_approvers_group = change_grp + ',' + current.ci_item.u_change_approval_group;
}
//Force update to make sure the business rule to calculate risk and the change type will run when new affected CI has been added regardless the CR has
been updated with new approvals.
gr.setForceUpdate(true);
gr.update();
}
})(current, previous);

Regards
Harish

View solution in original post

37 REPLIES 37

sudhakar8
Tera Contributor

Hi I have written one client script on "required approval(glide list field)" 

When sub-category is "firewall" add Information approval group to required approval group

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading ) {
return;
}

if(g_form.getValue('type') != 'standard') {
if(newValue =='Firewall Policy Addition')
{
g_form.setValue('u_manual_group_approvals','Information group');
}

}
//Type appropriate comment here, and begin script below

}

 

 

 

due to this 

 

1) When i delete any CI form affected CI it is clearing "Information group " from "required approval" 

2) when we change sub-category it is clearing all the approval groups from "required approval" field

then you need to run the BR when category and subcategory changes. so that it will sync with your client script.

Regards
Harish

sudhakar8
Tera Contributor

we need to update delete BR

I am not sure abt your requirement. Try updating the BR and check.

Regards
Harish

sudhakar8
Tera Contributor

example :

 

Change would like 'Required Approvals' to be added to a CMR automatically, based on the 'Change Approval Group' attribute on a CI (CI criteria: it is not Non-Operational) this would include CIs that are added to both the primary affected CI variable or or those included as part of the Affected CI TAB).

 

 

Change would like 'Required Approvals' to be added to a CMR automatically, based on the 'Change Approval Group' attribute on a CI (CI criteria: it is not Non-Operational) this would include CIs that are added to both the primary affected CI variable or or those included as part of the Affected CI TAB).