- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2016 06:27 AM
My users would like an email notification come out of a workflow. That's all fine and dandy. However, they would like the body of the email to be based on some of the values entered on the service request. For instance if a field says approver they would like the email text to reflect approver otherwise have it reflect non-approver. Will mail_script work within a Workflow Notification? I'm not getting any output from the if statement below.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2021 11:54 AM
This is really old and I don't recall why my question. Thanks for replying. I guess I better mark it closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2018 02:11 AM
In workflow activities if you want to use variables of catalog item, you need to dot walk using "current" object use ${current.variables.<variable_name>}
Ex:
Request Type: ::::> ${current.variables.dialer_req_type}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-12-2019 12:58 PM
Thanks for the dot walking advice.. do you have any recommendations if this doesn't pull it up the variable needed...
I am trying to pull Employee Name from the Request so I'm using
${current.variables.employee_name} and it's not working.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2021 01:17 PM
Hey Lenna,
I know this post is old, but you do not need curly brackets or the dollar sign in the mail script.
Try the below code.
<mail_script>
if(current.variables.employee_name == 'xxxxx')
{
template.print('Whatever verbiage is needed');
}
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2021 01:22 PM
Hey Steven,
I know this post is a bit old, but if you decide to use a mail script in a workflow notification you do not need curly brackets or the dollar sign.
Please try the below code when using a mail script.
<mail_script>
if(current.variables.g_Access_Needed == 'Approver')
{
template.print('Approver & Editor');
}
else
{
template.print('Not Approver');
}
</mail_script>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2021 06:45 PM
Hey Derek,
without much success, I tried to modify the mail script [request.itil.approve.role_script_1] below so that the Request Approval notification only displays only selected variables. Current, the notification is displaying every available variable. If you are able, could you please help? Thanks.
template.print("Summary of Requested items:\n");
var item = new GlideRecord("sc_req_item");
item.addQuery("sys_id", current.sysapproval);
item.query();
while(item.next()) {
template.print(item.number + ": " + item.quantity + " X " + item.cat_item.getDisplayValue() + " at " + item.price.getDisplayValue() + " each \n");
template.print(" Options:\n");
var keys = new Array();
var set = new GlideappVariablePoolQuestionSet();
set.setRequestID(item.sys_id);
set.load();
var vs = set.getFlatQuestions();
for (var i=0; i < vs.size(); i++) {
if(vs.get(i).getDisplayValue() != '') {
template.space(4);
template.print(' ' + vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "\n");
}
}
}