Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

How to redirect users to ritm using notification email script ?

Ujjwala1
Tera Contributor

Hello Experts,

I have to put the link in the notification which will redirect the user to the portal view and on the RITM

Here' s what I have written

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,

/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,

/* Optional GlideRecord */
event) {
var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=sc_request&table=' + '&view=sp' + '&sys_id=' + current.sys_id + '">${request_item}</a>';

template.print(url);

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

 

User has reported issue as this link is redirecting user to the task portal view not the RITM portal view

Please suggest me where I have made a mistake,

Thank you in advance!

Ujjwala

1 ACCEPTED SOLUTION

Mike_R
Kilo Patron

What table is your notification running on? Task or RITM?

If task/sc_task try changing current.sys_id to current.request_item.sys_id

 

 

 

View solution in original post

3 REPLIES 3

Mike_R
Kilo Patron

What table is your notification running on? Task or RITM?

If task/sc_task try changing current.sys_id to current.request_item.sys_id

 

 

 

Ujjwala1
Tera Contributor

Hi Mike,

Thank you for replying, It is on the task table, I'll try using this current.request_item.sys_id

 

Abhit
Tera Guru

Hi @Ujjwala1 

 

Update your href with the below ones as per your requirement 

 

//for portal view
var href = gs.getProperty('instance_name')+".service-now.com/sp?id=ticket&table=sc_req_item&sys_id="+current.sys_id+"&view=sp";
//for platform view
var href = gs.getProperty('instance_name')+".service-now.com/sc_req_item.do?sys_id="+current.sys_id;

 

Abhit