- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 01:39 AM
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)
Solved! Go to Solution.
- Labels:
-
Change Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 02:07 AM
//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);
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 02:03 AM
Can you please share me the full code for After insert BR

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 02:07 AM
//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);
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2021 10:46 PM
Hi
As i need this functionality only for Application Services CI, I have addedd 'Additional Approval Group' List field in Application services. Do you think I should add this field in cmdb_ci table?
but I am not sure how can I get the approvals triggered for this additional groups on click of a button called 'Request Approval'. there are already single group approval (Out of the Box) getting triggered on this button click.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 02:20 AM
(function executeRule(current, previous /*null when async*/) {
var gr = new GlideRecord('change_request');
gr.addQuery('sys_id', current.task);
gr.query();
gs.addInfoMessage("This is gr.nextt: " + gr.next());
if(gr.next())
{
var change_grp = gr.u_manual_group_approval.toString();//(u_manual_group_approval(glide list field on change form "required approvals)
if (change_grp.indexOf(current.cmdb_ci.change_control) < 0) // cmdb_ci(Affected ci) change_control(Approval group for Affected CI)
{
gr.u_manual_group_approval = change_grp + ',' + current.cmdb_ci.change_control;
}
//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 hasbeen updated with new approvals.
gr.setForceUpdate(true);
gr.update();
}
})(current, previous);
I have updated like this

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 02:28 AM
it is not working?
put the log and check
Harish