change request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
answer = {
// Configure policy inputs here
u_vp_approval_mandatory: false
};
var vp_approval_required = false;
var gr_conflict = new GlideRecord('conflict');
gr_conflict.addEncodedQuery("change=" + current.sys_id + "^type=blackout^schedule.ref_cmn_schedule_blackout.u_vp_approval_req=true");
gr_conflict.query();
if (gr_conflict.next()) {
// If VP field is empty, no VP approval is required
if (!current.assigned_to.u_vp) {
vp_approval_required = false;
current.work_notes = "Current User does not have a VP. VP approval NOT required."; // Optional
} else if (current.assigned_to.manager != current.assigned_to.u_vp) {
vp_approval_required = true;
} else {
// manager and VP are same, do not require approval
vp_approval_required = false;
}
}
if (vp_approval_required) {
answer.u_vp_approval_mandatory = true;
}
for this script work notes is not being updated on the change request form when assigned user vp is empty
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hello @Bhavani1995 ,
Can you please try with this
answer = {
u_vp_approval_mandatory: false
};
var vp_approval_required = false;
var gr_conflict = new GlideRecord('conflict');
gr_conflict.addEncodedQuery("change=" + current.sys_id + "^type=blackout^schedule.ref_cmn_schedule_blackout.u_vp_approval_req=true");
gr_conflict.query();
if (gr_conflict.next()) {
// If VP field is empty, no VP approval is required
if (!current.assigned_to.u_vp) {
vp_approval_required = false;
current.work_notes = "Current User does not have a VP. VP approval NOT required.";
current.setWorkflow(false);
current.update();
}
else if (current.assigned_to.manager != current.assigned_to.u_vp) {
vp_approval_required = true;
}
else {
// manager and VP are same, do not require approval
vp_approval_required = false;
}
}
if (vp_approval_required) {
answer.u_vp_approval_mandatory = true;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
where is this script written?
share some screenshots and detailed business requirement
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
This is written for change request non standard workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
This is written for change request non standard workflow