Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to add sla response (duration) field in notification message

Niranjan2
Tera Contributor

Hi 

 

In notification message, i would like to include what's the priority of a case along with response time (duration).

Ex: if the case is P1 and Response for it is 15min. Message would be "hey your case is 1-Critical and expect response in 15min. 

 

 

1 REPLY 1

Sumanth16
Kilo Patron

Hi @Niranjan2 ,

 

You could write a script in the notification to print any related SLA info in your email:



<mail_script>
var sla = new GlideRecord('task_sla');
sla.addQuery('task', current.sys_id);
sla.query();
while(sla.next()){
template.print(sla.time_left + "\n");
//at this point you can print out any fields from the task_sla table using the sla GlideRecord object looking at the example above
}
</mail_script>

 Note: Ttask has a 1 to many relationship with task SLA and so you have no ability to dot walk to the sla records that are created in task_sla table, also the task_sla record would be created after the task is inserted and so could potentially not be available.
if there will be only 1 SLA that needed to be identified per task, then I would look at moving the notification from your task table to task_sla and triggering on insert of the task_sla record as you can then dot-walk back to your task record to populate all of the details.

 

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda