UI Action: Approval Reminder Email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2012 12:16 PM
I was wondering if someone can help me with a UI Action that I want to create. I want to place a form button UI Action on my Service Catalog Items; that once selected would query any approvals that are in the state of Requested and send them a notification. Any way i can get help with starting the script on how to query it.
Thank you very much for the help
- Labels:
-
Analytics and Reports

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2012 04:05 PM
You can use this script in your UI Action. It queries all approvals of the current item that are in the requested state, then fires the approval.inserted event for each approval it finds. You will want to make sure that the event name in the script matches the approval inserted event name in your instance. In older instances I've seen
as the event that triggers the email.
item.approval.inserted
var approval = new GlideRecord('sysapproval_approver');
approval.addQuery('sysapproval', current.sys_id);
approval.addQuery('state', 'requested');
approval.query();
while (approval.next()) {
gs.eventQueue('approval.inserted', approval, approval.state);
gs.addInfoMessage("Approval resent to " + approval.approver);
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2015 01:58 AM
Hi Brad,
Thank you so much for your illustrative approach above. I am also creating an on demand approval reminder set uo and I have create below setup. however, it seems it is breaking somewhere. could you please take a look:
1. event named approval.reminder on sysapproval_approver table.
2. After that I have created a UI action with below script
function remindermail(){
gsftSubmit(null, g_form.getFormElement(), 'approval_reminder'); //MUST call the 'Action name' set in this UI Action
}
if (typeof window == 'undefined')
updateRecord(current);
function updateRecord(){
var app = new GlideRecord("sysapproval_approver");
app.addQuery("sysapproval", current.sys_id);
app.addQuery("state", requested);
app.query();
while(app.next()){
gs.eventQueue("approval.reminder", app, gs.getUserID(), approval);
gs.addInfoMessage('Approval mail has been sent');
current.update();
action.setRedirectURL(current);
gs.log("approval reminder");
}}
3. After I have create the same event based notification on change_request table which will be invoked by the UI action.
But I believe the UI action is not working in the first place. Could you please take a look into the script and let me know the issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2015 06:46 AM
Did some re-check it worked now:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2023 08:15 PM
Hey Chandresh, could you please let me know where did you change the above script to get working. I am stuck with same problem
Thanks