Pop-up confirmation upon approval
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2024 12:31 PM
When the approver goes to approval table to approve the request.
Once the approver clicks on Approve UI action button, he should receive a confirmation box saying ' Do you want to approve the request or you still want to continue reviewing? '
If approver click on OK, then request should be approved else it should be untouched (same as before).
If anyone can help. It would be highly appreciated!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-24-2024 05:13 PM
Hi @VS_09,
You would need to customize the 'Approve' UI Action such that it runs both client-side and server-side codes.
Refer to this article for details - https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB1005843
For your UI Action, it will be something like below (Note that your 'Approve' UI Action will be different to the example below)
Action name: approve_record
Client checkbox: true
Onclick: promptApprover();
Script:
function promptApprover() {
if (confirm("Do you want to approve the request?")) {
gsftSubmit(null, g_form.getFormElement(), 'approve_record');
} else {
return;
}
}
if (typeof window == 'undefined')
updateApprovalRecord();
function updateApprovalRecord() {
//Copy and paste your UI Action's server script
}
Hope it helps, cheers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2024 06:08 PM
That's correct!! But it will impact all the 'Approve' UI Actions for all tables Incident, RITM, Change.
My requirement is to work only for Change request.
If anyone can reply...It would be highly helpful!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2024 06:45 PM
You can either create another UI Action that is displayed only on a Change approval or modify the above script to prompt the message only on Change approval.
Either way, note that this will only work with that particular UI Action. i.e. Approval from portal, mobile, etc will not behave the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2024 07:34 PM - edited ‎03-06-2024 07:56 PM
Thanks for the reply.
Below is the error I am getting for my script when I tried to approve the change request.
Can you please have a look?