Can someone help me how to add RITM links in the notification email script

NagaNandini N
Tera Guru

Hi All,

 

Can someone help me how to add RITM links in the notification email script? I have added the below code but instead of a URL link, the URL is getting printed on the mail. 

 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

          // Add your code here

var url = 'a href="' + gs.getProperty('instance_name')+".service-now.com/sp?id=ticket&table=sc_req_item&sys_id="+current.sys_id+"&view=sp"+'">Click here to go to RITM</a>';
template.print(url);

})(current, template, email, email_action, event);
 
 
Please find the screenshot for reference.
 
1 ACCEPTED SOLUTION

Hi Dipen ,

 

The link works now but I need to add the RITM number and I have tried adding it like this. Please find the screenshot for your reference

 

Below is the working code and I need to add RITM number in the view. Please help me on this.

 

var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=sc_req_item&sys_id='+current.sys_id + '">' + '<b> Take me to the RITM Service Portal View: current.request_item.number </b>' + '</a>';
template.print(url);

View solution in original post

14 REPLIES 14

Danish Bhairag2
Tera Sage
Tera Sage

Hi @NagaNandini N ,

 

If you have your notification on RITM table itself u can use this in your notification body ${URI_REF} wherever u want to display the hyperlink for the RITM ticket. ( this will display the data in the native view)

 

If you want to display it on portal use below link

var link = "<a href =" + gs.getProperty('glide.servlet.uri') + "service-now.com/sp?id=ticket&table=sc_req_item&sys_id="+current.sys_id+"&view=sp>Click Here</a>";

 

Mark my answer as Helpful & Accepted if it helps you resolve your issue.

 

Thanks,

Danish 

Hi @Danish,

 

${URI_REF} - This one is taking me to the fulfiller end view. Users need to view it in the SP (service portal view). Please suggest me 

Hi @NagaNandini N ,

 

If you want to display it on portal use below link

var link = "<a href =" + gs.getProperty('glide.servlet.uri') + "service-now.com/sp?id=ticket&table=sc_req_item&sys_id="+current.sys_id+"&view=sp>Click Here</a>";

 

Mark my answer helpful & accepted if it helps you.

 

Thanks,

Danish

var link = "<a href =" + gs.getProperty('glide.servlet.uri') + "service-now.com/sp?id=ticket&table=sc_req_item&sys_id="+current.sys_id+"&view=sp>Click Here</a>";

This one is not working. I applied this in the notification email script and called in a notification nothing is displayed.