- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 02:28 AM
Hi All,
I have a requirement in a Service catalog where all approver in the approval group has to approve. If one approver rejects, it should not end the work flow. How to retrigger approval for the rejected approver. The rejection reason could be the variables in the catalog form has to change.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 02:45 AM
To implement this requirement in ServiceNow, you can follow these steps:
1. Create a custom workflow for the catalog item.
2. In the workflow, use the 'Approval - Group' activity to assign the approval to a group.
3. Set the 'If anyone rejects' field to 'Ignore' in the 'Approval - Group' activity. This will ensure that the workflow does not end if one approver rejects.
4. Add a script to the 'Rejected' condition of the 'Approval - Group' activity. This script should retrigger the approval for the rejected approver.
5. To retrigger the approval, you can use the 'Approval - User' activity and assign it to the rejected approver.
6. To change the variables in the catalog form based on the rejection reason, you can use the 'Run Script' activity in the workflow. This script should update the variables based on the rejection reason.
Here is a sample script for the 'Rejected' condition:
javascript
var approval = new GlideRecord('sysapproval_approver');
approval.addQuery('state', 'rejected');
approval.addQuery('source_table', 'sc_req_item');
approval.addQuery('source_id', current.sys_id);
approval.query();
while (approval.next()) {
// Retrigger approval for the rejected approver
var retriggerApproval = new GlideRecord('sysapproval_approver');
retriggerApproval.initialize();
retriggerApproval.state = 'requested';
retriggerApproval.source_table = 'sc_req_item';
retriggerApproval.source_id = current.sys_id;
retriggerApproval.approver = approval.approver;
retriggerApproval.insert();
// Update variables based on the rejection reason
var variables = new GlideRecord('sc_item_option_mtom');
variables.addQuery('request_item', current.sys_id);
variables.query();
while (variables.next()) {
// Update the variables as per your requirement
}
}
Please note that this is a sample script and you may need to modify it as per your requirement.
nowKB.com
For asking ServiceNow-related questions try this :
For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.
Link - https://nowgpt.ai/
For the ServiceNow Certified System Administrator exams try this :
https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2024 02:31 AM
OOTB not possible and also not recommended. If in a group 5 users are there and the person who rejected earlier and if you retrigger only to that user and that user is OOO then how will handle this.
So better, and OOTB, retrigger approval to all group.
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
02-20-2024 02:45 AM
To implement this requirement in ServiceNow, you can follow these steps:
1. Create a custom workflow for the catalog item.
2. In the workflow, use the 'Approval - Group' activity to assign the approval to a group.
3. Set the 'If anyone rejects' field to 'Ignore' in the 'Approval - Group' activity. This will ensure that the workflow does not end if one approver rejects.
4. Add a script to the 'Rejected' condition of the 'Approval - Group' activity. This script should retrigger the approval for the rejected approver.
5. To retrigger the approval, you can use the 'Approval - User' activity and assign it to the rejected approver.
6. To change the variables in the catalog form based on the rejection reason, you can use the 'Run Script' activity in the workflow. This script should update the variables based on the rejection reason.
Here is a sample script for the 'Rejected' condition:
javascript
var approval = new GlideRecord('sysapproval_approver');
approval.addQuery('state', 'rejected');
approval.addQuery('source_table', 'sc_req_item');
approval.addQuery('source_id', current.sys_id);
approval.query();
while (approval.next()) {
// Retrigger approval for the rejected approver
var retriggerApproval = new GlideRecord('sysapproval_approver');
retriggerApproval.initialize();
retriggerApproval.state = 'requested';
retriggerApproval.source_table = 'sc_req_item';
retriggerApproval.source_id = current.sys_id;
retriggerApproval.approver = approval.approver;
retriggerApproval.insert();
// Update variables based on the rejection reason
var variables = new GlideRecord('sc_item_option_mtom');
variables.addQuery('request_item', current.sys_id);
variables.query();
while (variables.next()) {
// Update the variables as per your requirement
}
}
Please note that this is a sample script and you may need to modify it as per your requirement.
nowKB.com
For asking ServiceNow-related questions try this :
For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.
Link - https://nowgpt.ai/
For the ServiceNow Certified System Administrator exams try this :
https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 10:39 PM
You accepted an answer which is given by chatGPT 😞
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
02-21-2024 04:33 AM
Thank you