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

Hi Danish,

 

PFA test results for your reference.

 

Regards,

Nandini N

Dipen Wadhwana
Giga Guru

Hi @NagaNandini N ,

 

Can you please try the  script :

 

 var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=sc_req_item&sys_id='+current.sys_id + '">' + 'Click here to go to RITM' + '</a>';
    template.print(url);

Please let me know if this works for you and mark helpful if its worked.

 

Thanks,

Dipen

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);

The below one is the correct code :

 

var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=sc_req_item&sys_id=' + current.sys_id + '">' + current.number+ '</a>';
template.print('<span style="font-family: Arial, sans-serif; font-size: 16px;">Take me to the RITM Service Portal View: ' + url + '</span>');
 
 
Thank you for your support Dipen.

@NagaNandini N You're welcome.