- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2019 06:30 PM
Hi,
I need to display a custom variable defined in sc_request table for my SLA notification. The custom variable is u_service_category. Can you give me an example how this can be accomplished? I am new to Service Now and any help will be greatly appreciated.
Thanks,
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2019 01:32 PM
Hi Arnab,
I logged into your instance and took a look around, I changed a few things and all of those updates are captured in the update set named "Test request sla" so it is easier for you to see what was changed, essentially.
1) There was not an SLA definition in the developer instance so I created one for the Request table.
2) I added "SLA" related list to the request form so I can see if SLA task is created.
3) I made some changes to the fields in the notification to get the correct values, I did not make any changes to the mail script you have in there, it printed out the correct value already without any changes needed.
Please take a look at these two emails, do they have all the information you needed? https://dev63739.service-now.com/sys_email_list.do?sysparm_query=sys_created_onONToday%40javascript%3Ags.beginningOfToday()%40javascript%3Ags.endOfToday()%5Esubject%3DSLA%20WARNING
Let me know if you have any questions 🙂
Thanks,
Phuong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2019 12:20 PM
Hi Phuong,
Thank you for the detailed explanation.I checked the task_sla.list and I see the Request. The event is getting triggered and I am getting e-mail notifications when SLA is in Warning and Breached state.
The only issue is with the custom field which is not getting populated on the e-mail notification.I am not clear how I can use the mail script to display the custom filed using the glide function.
I have current.task.u_service_category in the mail script, however it is not available under selected variables on the e-mail notification.
I have a seperate personal dev instance with that e-mail notification. You can login. I appreciate your help and support.
admin/Admin123
https://dev63739.service-now.com
Notification SLA warning REQ
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2019 12:26 PM
Because the field you want 'u_service_category' is on the sc_request table, not the task table itself, you need to fetch the request itself to get the table specific fields
Try this in your mail script
var request = new GlideRecord('sc_request');
request.get(current.task);
template.print("Service Category " + request.u_service_category.getDisplayValue());
Note the getDisplayValue(), its a good idea to get a human readable copy, especially if its a choice or reference field, else it will be the internal value.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2019 01:32 PM
Hi Arnab,
I logged into your instance and took a look around, I changed a few things and all of those updates are captured in the update set named "Test request sla" so it is easier for you to see what was changed, essentially.
1) There was not an SLA definition in the developer instance so I created one for the Request table.
2) I added "SLA" related list to the request form so I can see if SLA task is created.
3) I made some changes to the fields in the notification to get the correct values, I did not make any changes to the mail script you have in there, it printed out the correct value already without any changes needed.
Please take a look at these two emails, do they have all the information you needed? https://dev63739.service-now.com/sys_email_list.do?sysparm_query=sys_created_onONToday%40javascript%3Ags.beginningOfToday()%40javascript%3Ags.endOfToday()%5Esubject%3DSLA%20WARNING
Let me know if you have any questions 🙂
Thanks,
Phuong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2019 03:44 PM
Hi Phuong,
Thank you so much for looking into this. I was able to make the changes as suggested by you and I am now receiving both warning and breached e-mail notifications with the custom field populate. I really appreciate your time and help on this.
Regards,
Arnab