- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2020 09:53 AM
I have a Catalog Item called "Employee Onboarding".
The first step in my workflow is a group approval.
I'd like to send out the approval notification request with the name of the new employee in the subject line.
The variable on the requested item is: "legal_name".
The notifications are being triggered from the "sys_approval" table, but variable is somewhere in the "requested_item" table I think.
Can this be done?
Solved! Go to Solution.
- Labels:
-
Request Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2020 08:26 AM
Heya Joe,
Yeah this is possible. Again this will need to be done in a mail script as you're hoping through related records to get the information.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var RITM = current.document_id.getRefRecord();
var workflowGR = new GlideRecord('wf_context');
workflowGR.addQuery('id', RITM.sys_id);
workflowGR.setLimit(1);
workflowGR.query();
if(workflowGR.next()){
var activityGR = new GlideRecord('wf_executing');
activityGR.addQuery('context',workflowGR.sys_id);
activityGR.query();
if(activityGR.next()){
var activity = activityGR.getDisplayValue('activity');
}
}
email.setSubject(RITM.getValue('number') + " " + activity);
})(current, template, email, email_action, event);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-15-2021 08:54 AM
Glad to hear it helped 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2020 10:57 AM
This worked perfectly the first time Kieran!
I've seem numerous other posts for a similar question.
Perhaps you might want to consider writing a generalized solution for everyone struggling to pull RITM variables into notifications scrips.
Thanks so much!
Joe

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2020 11:52 AM
Oh good idea Joe,
I'll add it to my list of articles I'm working on. Glad my solution worked!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2020 06:46 AM
Kieran,
On a related matter, how can I customize the approval notification emails?
I want the subject line going to the approver to have the specific short description of the workflow activity instead of the overall RITM description.
So for instance, if my RITM short description is "Hardware Requests", and I have a group approval step in the workflow with the activity title of "Approve Laptop Requests", I'd like the approver to get an email with the subject line "Please Approve Laptop Requests", not "Please approve Hardware Requests".
Joe

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2020 08:26 AM
Heya Joe,
Yeah this is possible. Again this will need to be done in a mail script as you're hoping through related records to get the information.
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var RITM = current.document_id.getRefRecord();
var workflowGR = new GlideRecord('wf_context');
workflowGR.addQuery('id', RITM.sys_id);
workflowGR.setLimit(1);
workflowGR.query();
if(workflowGR.next()){
var activityGR = new GlideRecord('wf_executing');
activityGR.addQuery('context',workflowGR.sys_id);
activityGR.query();
if(activityGR.next()){
var activity = activityGR.getDisplayValue('activity');
}
}
email.setSubject(RITM.getValue('number') + " " + activity);
})(current, template, email, email_action, event);