- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2018 03:31 PM
Hello all,
I am trying to find a way to display the checkbox value instead of "true" "false" on the email notification "Request Opened on behalf". We would like for the requester to receive a list of the software requested in the email, but the way the values are showing now are just true, false.
I looked through other threads and some say email script but I have no idea where to get started on this because I don't know much about scripting, but can anyone assist with this? Or point me to the right direction?
E.g. Software list: microsoft office, adobe creative cloud, dreamweaver, etc.
If user selects office but not the other ones then the email notification look something like this:
Number: RITM4242
Requested for: Jane Doe
Software requested: Microsoft Office
My email script below:
Thanks in advance,
Grace
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2018 11:19 AM
This was my solution:
1. Create a notification email script (e.g. checkbox) and list out your checkbox values accordingly:
(function runMailScript(current,template,email,email_action,event) {
if(current.variables.checkbox_value=='true'){
template.print("Checkbox Name," + ' ' );
}
if(current.variables.checkbox_value2=='true'){
template.print("Checkbox Name2," + ' ');
}
..........
template.print('</p>');
})(current, template, email, email_action, event);
2. Create an email notification and add the email script to an email template
e.g. Add the following in message HTML = ${mail_script:NAMEHERE}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2018 07:31 PM
You can create a notification email script and use it in the email notification body. Please create email script something like below.
var url='';
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.sys_id);
gr.query();
while(gr.next()) {
url = "https://"+ gs.getProperty('instance_name') +".service-now.com/sp?id=form&view=ess&table=sc_req_item&sys_id="+gr.sys_id;
template.print('<a href='+url+'>' + gr.number +' - ' + gr.cat_item.name + '</a><br/>' + "\n");
}
Please copy and paste the code as it is, it should work without any changes (UNLESS YOU HAVE ANY CUSTOM FIELDS WHICH CAPTURE ITEM NAME).
Please hit correct based on impact of response.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 08:58 AM
Thanks for the response! I created the notification email script with your suggested code and replaced the instance name with ours but it didn't return anything.
When you say "unless you have any custom fields which capture item name" does that mean I should be specifying my checkbox values?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2018 11:22 AM
You not replace the instance name. It is a property available in your servicenow environment and fetches the value from there. Please revert it back.
No you should not display any check box values. I mean to say about the Item field on RITM form. If you guys are using any custom field, you have to replace it with that particular, which I hardly believe it isn't the case.
Please hit correct based on impact of response.
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2018 02:07 PM
I reverted back but still the email isn't returning any value not even true/false for the checkboxes.