- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2015 09:02 AM
Hi there
In order to Reject Approval from a Context Menu, I have created a ui action which then calls a ui page (with client script included) and displays a dialog box, however when I click 'Ok' on the dialog box I'd like the text that was entered into the dialog box to copy into the comments box in the approval form. Can't figure out how to do this? Ideas welcome 🙂
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2015 03:52 AM
UI action script: (Just add the line in bold)
function popupRejectApproval() {
var gdw = new GlideDialogWindow('reject_request');
gdw.setTitle('Reject this Request');
gdw.setPreference("selectedRecord",rowSysId);
gdw.render();
}
UI page client script:
function validateComments() {
var selectedRecord = "${RP.getWindowProperties().get('selectedRecord')}";
var dialcoms = gel("dialog_comments").value;
var comments = trim(dialcoms);
if (comments == "") {
alert("Comments are mandatory for rejection");
return false;
}
var getApproverRecord = new GlideRecord('sysapproval_approver');
if(getApproverRecord.get(selectedRecord))
{
getApproverRecord.comments=comments;
getApproverRecord.state='rejected';
getApproverRecord.update();
}
GlideDialogWindow.get().destroy(); //Close the dialog window
}
Note: Change the querying part to a glideajax. Once the record is updated, redirect to the record you want else the screen will appear as static making you believe that the update has not happened.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2015 03:43 AM
You can run a one time job to fix existing approvals Use the same code as the base for your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2015 08:22 AM
I'm sorry I've got one last question for you?
Do you know what I can add to the client script (I guess) to refresh the list?
thanks again
Eva

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2015 09:44 AM
Add the line in bold before destroying the page in the UI page's client script.
GlideList2.get('sc_req_item.sysapproval_approver.sysapproval').setFilterAndRefresh('');
GlideDialogWindow.get().destroy(); //Close the dialog window
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2015 01:09 AM
Thank you so much! Worked a treat.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2015 03:41 AM
Hi Kalai
I'm so sorry - can I ask 1 final question of you?
I need to do the same for the change_request I can't figure out the 'or' '||' statement for this. i.e. I want it to update either the sc_req_item or the change_request tables dependant on which table I'm rejecting on.
Thanks Eva