Normal Change Workflow, Defer to CAB from Technical Approvals

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2024 11:32 PM
Hello all,
I am hoping to that someone can help me out, and it must have been done before. I am trying to create a defer to CAB option from an approval request.
I am struggling to progress a workflow, i have created a new condition in the Technical Approval options. The Approved and Rejected conditions work fine, but i added another option called Deferred to defer to CAB as opposed to rejecting it back to New. Attached is a screen shot of the Workflow,
I created a new option in the approvals state called Deferred - matched it to the condition so that i could select an option to approve. I am sure i missing things, as i cannot get the condition when selected to move to the next part of the workflow. What am i missing please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2024 04:20 AM
Yes mate, agree. that script will do all work to connect the dots.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 04:30 AM
Hell Atul,
I have been using the AI tech to build scripts, and i have managed to to get the workflow to progress now except it skips over the technical approvals with an error, allowing me to get to CAB - except i need it to ask for the approval, so that approval, reject or deferred is used.
Script looks like this currently. I am wondering if i need to replace any words with actual workflow names etc... currently working my way through:
// Get the approval group from the workflow input
var approvalGroup = current.variables.approval_group;
// Initialize the approval object
var approval = new GlideApproval();
approval.setRequest(current);
approval.setType('group');
approval.setApprovers(approvalGroup);
// Set the approval options
approval.setApprovalOptions('1','Approved'); // Option 1 = Approved
approval.setApprovalOptions('2','Rejected'); // Option 2 = Rejected
approval.setApprovalOptions('3','Deferred'); // Option 3 = Deferred
// Set the wait for option (all or any)
// Change 'any' to 'all' if all users in the group need to approve
approval.setWaitFor('any');
// Initiate the approval process
var result = approval.execute();
// Check the approval result
if (result == 'approved') {
// Workflow continues - Approval granted
gs.log("Technical approval granted by group: " + approvalGroup);
} else if (result == 'rejected') {
// Workflow stops - Approval rejected
gs.log("Technical approval rejected by group: " + approvalGroup);
// Add additional logic here to handle rejection (e.g., set rejection reason)
} else if (result == 'deferred') {
// Workflow can be customized for deferral (optional)
gs.log("Technical approval deferred by group: " + approvalGroup);
// Add logic to handle deferral (e.g., set deferral reason)
} else {
// Handle other potential errors
gs.error("An error occurred during group approval: " + result);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 07:18 AM
Scripts look good to me, but still i recommend , @AshishKM @Sandeep Rajput to put his expertise.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************