E-Mail Script to display custom field(variable)

Arnab22
Giga Expert

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,

 

1 ACCEPTED SOLUTION

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

View solution in original post

18 REPLIES 18

So where is u_service_category field created in task sla table or in sc_request table? If it is on task sla table we cannot use current. What is the relation between service category and sla? Is that field used as reference in task sla table??

Hi,

U_service_category field is in sc_request table. My e-mail notification is based on task_sla.

I haven't created any relation between service category and task_sla. I am not sure how that is done? That is a reason, I don't see variable from option selected variable in notification message body.

Thanks

Share a screen shot of your sla form, you have request/task field in sla form??

Phuong Nguyen
Kilo Guru
Hi Arnab,
Since your notification is on the task_sla table, it will not be visible from the fields list. How is your SLA triggered on the sc_request table? Did you add SLA definition to that table? similar to that of the incident table? If so, whenever an SLA task is created, your request should be in the "Task" reference field, from there you can dot walk to your desired field, in this case it is u_service_category.
Thanks,
Phuong

Hi Phuong,

Below is a screenshot. I compared the sc_request table and Incident table and I see the SLA definition. I am not sure what I am missing. Do I need to create a request_task table similar to Incident_task table?

find_real_file.png