Mandatory comments on approval reject using Reject UI Action (list choice and list context menu)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 12:17 AM
Hi Experts,
I have a requirement where on click of Reject button from a Change/RITM record Approvers related list I want to display a popup enforcing users for fill in the rejection comment which should get copied to the Approver table activity journal.
Any solution to achieve the same would be much appreciated.
Regards,
Somujit
- Labels:
-
Change Management
-
Request Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 01:02 AM
Hi @Somujit1 ,
I trust you are doing great.
To achieve this, we can create a UI action on the Change/RITM record Approvers related list's Reject button. This UI action will trigger a client-side script that will display a popup to the user asking for the rejection comment. Once the user fills in the comment, the script will copy the comment to the activity journal field on the Approver table.
function showRejectionCommentPopup() {
var comment = prompt("Please enter a comment for rejecting the request", "");
if (comment != null && comment != "") {
// Copy the comment to the activity journal field
var gr = new GlideRecord('sysapproval_approver');
gr.get(g_list.getChecked());
gr.comments = comment;
gr.update();
// Reload the related list
g_list.refresh();
}
}
// Create the UI action
var rejectUIAction = {
name: 'Reject with Comment',
action: showRejectionCommentPopup,
condition: function() {
// Only show the UI action if at least one record is selected in the related list
return g_list.getChecked().length > 0;
}
};
// Add the UI action to the related list's dropdown menu
addUIAction('related_lists', rejectUIAction);
Was this answer helpful?
Please consider marking it correct or helpful.
Your feedback helps us improve!
Thank you!
Regards,
Amit Gujrathi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-26-2023 07:16 AM
Hi @Amit Gujarathi,
Thanks for your reply.
Not sure if I understood your suggestion correctly.
Is it that I need to create a UI action on the sysapproval_approver table as attached and an OnLoad client script on the sysapproval_approver table with the script shared by you?
I tried doing the same but no luck.
Please correct me if I am wrong
Regards,
Somujit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2024 09:03 AM
I agree with Somujit, please add more context to the proposed solution.