- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2018 06:49 AM
Hello All,
I am trying to create a confirm prompt within the Reject UI action on the Change Request table. However, the client side "onclick" function does not appear to be working as it will not display the confirm box when rejecting a request. Something to note is that the rejection is being done in the list view for the Approvers tab. Our CAB admin will go to his name and right click and hit approve/reject. This maybe the reason the code UI action is not working but I needed some help getting in the right direction.
//Client-side 'onclick' function
function rejectRequest () {
var answer = confirm("Are you sure you want to Reject this request?");
if (answer == true){
gsftSubmit(null, g_form.getFormElement(), 'reject');
}
else {
return false;
}
}
//Code that runs without 'onclick'
if (typeof window == 'undefined') {
runRejectBusRuleCode();
}
//Server-side code
function runRejectBusRuleCode() {
current.approval = "rejected";
current.update();
new UIActionUtils().approvalsNoLongerRequired(current.sys_id);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2018 06:58 AM
I don't think this is going to work for you since you're trying to do this on a list. I see g_form.getFormElement() - g_form is only available when you load a form.
Check the OOB UI actions to see if any list UI actions have a confirm in the script. I see a few with the filter "List action | is | true AND Script | contains | confirm".
Change YOURINSTANCENAME to your instance name in the URL below.
https://YOURINSTANCENAME.service-now.com/sys_ui_action_list.do?sysparm_query=list_action%3Dtrue%5EscriptLIKEconfirm&sysparm_list_mode=grid

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2018 06:58 AM
I don't think this is going to work for you since you're trying to do this on a list. I see g_form.getFormElement() - g_form is only available when you load a form.
Check the OOB UI actions to see if any list UI actions have a confirm in the script. I see a few with the filter "List action | is | true AND Script | contains | confirm".
Change YOURINSTANCENAME to your instance name in the URL below.
https://YOURINSTANCENAME.service-now.com/sys_ui_action_list.do?sysparm_query=list_action%3Dtrue%5EscriptLIKEconfirm&sysparm_list_mode=grid