Add RITM Number Link on email notification which runs on Catalog Task

Meenal Gharat
Giga Guru

Hi All,

Can someone help me to correct email script for RITM Number Link.

My notification is running on Catalog Task table. Whenever An RITM is commented, An email is getting triggered I want to add RITM link of service portal in email notification.

 

Thanks And Regards,

Meenal Gharat

 

1 ACCEPTED SOLUTION

Meenal Gharat
Giga Guru

Hi All,

 

I have identified a way and it is working like a charm.

So, Below is my code which worked.

 

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

var url='';
var gr = new GlideRecord('sc_req_item');
gr.addQuery('sys_id',current.request_item);
gr.query();
if(gr.next())
{
var sysid = gr.sys_id;

gs.log(sysid+ 'Get sysid');

template.print('<a href="enter your portal url sys_id='+sysid+'">' +gr.number+ '</a>');
}
}

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

 

Thank you,

Meenal Gharat

View solution in original post

6 REPLIES 6

vinothkumar
Tera Guru

You open the notification and you can directly select the RITM instead of catalog task

Hi Vinoth,

 

Thanks, for your response we are using Catalog Task because we have add Task Number as well in the notification.

 

I have tried using below email script.

var gr = new GlideRecord('sc_req_item');


gr .addQuery('number',sys_id);

gr.query();

if(gr.next())

{

template.print('<a href="/ess?id=ticket&table=sc_req_item&sys_id ='+gr.sys_id+'">' + gr.number + '</a>');
}

AbhishekGardade
Giga Sage

Hello Meenal

You need to use:

${URI} in email body to get RITM LINK:

REFERENCE:

https://www.servicenowguru.com/system-definition/email-notifications-system-definition/email-links-u...

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

 

Thank you,
Abhishek Gardade

Hi Abhishek,

 

Appreciate your help, but my Notification is on Catalog Task.

So this will give me Task link.

I also tried ${request_item.URI_REF}

This is giving RITM link but it is taking me to ITIL View. I want to redirect it to Portal View.

 

Thanks and Regards,

Meenal