how to include Catalog task number in the email notification on RITM table?once click on task number record should be open

Santoshi5
Giga Guru

I have created email notification on RITM table i need 3 links on the same notification , 1 is for RITM number and other 2  for sc_task ,

I am using below for RITM number link .but how can i achieve the same for Catalog Task no. on same notification

${URI_REF}

Thanks and advanced.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

for that you need to use mail script

Create new mail script and add it to notification

I assume your email notification is on RITM table

How to call in Notification: ${mail_script:show_sc_task_link}

Name: show_sc_task_link

Mail Script:

(function runMailScript(current, template, email, email_action, event) {

    // Add your code here

var taskRec = new GlideRecord('sc_task');

taskRec.addQuery('request_item', current.sys_id);

taskRec.query();

while(taskRec.next()){

    var url = '<a href="' + gs.getProperty('glide.servlet.uri') + '/nav_to.do?uri=' + taskRec.getTableName() + '.do?sys_id=' + taskRec.sys_id + '">' + taskRec.getDisplayValue() + '</a>';  
    template.print(url);  

}


})(current, template, email, email_action, event);

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

7 REPLIES 7

Santoshi5
Giga Guru

i changed the query filter now its working fine

mail script:

var Rec = new GlideRecord('u_entries');

Rec.addQuery('u_source', current.sys_id);
gs.log('number of entries'+current.u_number);

Rec.query();

while(Rec.next()){

//template.print(Rec.number);
var url = '<a href="' + gs.getProperty('glide.servlet.uri') + '/nav_to.do?uri=' + 'u_entries' + '.do?sys_id=' + Rec.sys_id + '">' + Rec.getDisplayValue() + '</a>'+'<br>';
template.print(url);

 

 

Glad to know

That's what I mentioned the query is not working because of field type

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

May I know what is inside below sys property:

('glide.servlet.uri')

 

Thanks in advance