Attach the link that will redirect to that particular RITM in service portal view

Rahul Raja Sami
Tera Guru

Hi, 

The below script is used to provide a link ' Take me to the item' along with the Notification which is sent to the caller.
this link redirects to the native UI page but I want to redirect to its RITM in the portal view.

how can I acheive this?

 

 

 

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

          // Add your code here
	var link = current.getLink();
	template.print('<font face="Arial">');
	var backgroundColor = 'background-color: #001440;';
	var border = 'border: 1px solid #0368d4;';
	var color = 'color: #ffffff;';
	var fontSize = 'font-size: 10pt;';
	var fontFamily = 'font-family:  Lato, Arial, sans-serif;';
	var textDecoration = 'text-decoration: none; border-radius: 3px;';
	var webKitBorder = '-webkit-border-radius: 4px;';
	var mozBorder = '-moz-border-radius: 4px;';
	var display = 'display: inline-block;';
	var padding = 'padding: 8px 20px;';
   var margin =  'margin-bottom: 36px;';
	
	template.print('<a href="' + link + '"');
 	template.print('style="' + backgroundColor + border + color + fontSize + fontFamily + textDecoration + webKitBorder + mozBorder + display + padding + margin);
	template.print('">');
	template.print(gs.getMessage('Take me to the RITM'));
	template.print('</a>');
})(current, template, email, email_action, event);

 

 

 

thanks,

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@Rahul Raja Sami 

you want to take user to the ticket page?

if yes then do this

var portalSuffix = 'sp'; // your portal suffix here
var link = portalSuffix + '?id=ticket&table=' + current.getTableName() + '&sys_id=' + current.sys_id;

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Rahul Raja Sami 

you want to take user to the ticket page?

if yes then do this

var portalSuffix = 'sp'; // your portal suffix here
var link = portalSuffix + '?id=ticket&table=' + current.getTableName() + '&sys_id=' + current.sys_id;

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

Hi Ankur,
Thanks for the above.
Can you please take a look at my other question as well?
Alphabets missing in serial number when data is im... - ServiceNow Community


Thanks,
Rahul.