- 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
09-23-2020 12:55 PM
Hi Joe,
When you say the notifications are being triggered from the sysapproval_approver table, is an approval record being created as part of a flow / workflow or are you using some sort of business rule to create an approval record?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 01:26 PM
Hi Kieran,
Yes. The BR triggers an event called "RITM Approval" any time there is an approval step in any workflow.
The notification that runs is called "Approval RITM from Event" which is run from the sysapproval_approver table.
It is triggered if the "RITM Approval" event is fired.
So all of this is working.
I want the approval notification that goes out to HR to say something in the subject line like "Please approve the RITM001233 onboarding request for NEW EMPLOYEE"
(Where NEW EMPLOYEE is a string that is a the "legal_name" variable from the onboarding form.)
Joe

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-23-2020 01:52 PM
Is this firing the approval.inserted event?
If so, you can create a new notification with a higher weight (i.e takes precedence) with a filter
Create a notification email script with the following script:
(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 name = RITM.variables.legal_name;
email.setSubject('Employee Onboarding Approval for - ' + name);
})(current, template, email, email_action, event);
Enter ${mail_script:employeeOnboarding} into the Message HTML section of your email. This will override the subject line.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-15-2021 08:49 AM
Kieran - thank you! This mail script is exactly what I needed in my situation to have approval request notifications show 'Approval Request - RITM1111111 - Requested Item Name'
THANK YOU!!!