incidents view redirect to portal view

Nitya2
Kilo Guru

we are using below email script , when we click on 'Take me in to the incident' its navigating to  itil(native view).

kindly help me to redirect to portal view .

email script -

 

(function runMailScript(current, template, email, email_action, event) {
	var link = current.getLink();
		if (email_action.name != "Incident Resolved") {
		template.print('<p><font size="3" color="#808080" face="helvetica">');
		template.print(gs.getMessage('You can view all the details of the incident by following the link below:'));
		template.print('</font></p>');
	}
	else {
		template.print('<p><font size="3" color="#808080" face="helvetica">');
		template.print(gs.getMessage('If you feel the issue is not resolved, please click the following link and reopen your incident:'));
		template.print('</font></p>');
	}
	template.print('<font face="helvetica">');
	
	var backgroundColor = 'background-color: #278efc;';
	var border = 'border: 1px solid #0368d4;';
	var color = 'color: #ffffff;';
	var fontSize = 'font-size: 16px;';
	var fontFamily = 'font-family: Helvetica, Arial, sans-serif;';
	var textDecoration = 'text-decoration: none; border-radius: 3px;';
	var webKitBorder = '-webkit-border-radius: 3px;';
	var mozBorder = '-moz-border-radius: 3px;';
	var display = 'display: inline-block;';
	var padding = 'padding: 5px;';
	
	if (email_action.name == "Incident Survey") {
		color = 'color: #343d47;';
		backgroundColor = 'background-color: #e6e8ea;';
		border = 'border: 1px solid #bdc0c4;';
	}
	template.print('<a href="' + link + '"');
	template.print('style="' + backgroundColor + border + color + fontSize + fontFamily + textDecoration + webKitBorder + mozBorder + display + padding);
	template.print('">');
	template.print(gs.getMessage('Take me to the Incident'));
	template.print('</a>');
	template.print('</font>');
	template.print('<br><br>');
	template.print('<p><font size="3" color="#808080" face="helvetica">');
	template.print('Thank you.');
	template.print('</font></p>');
})(current, template, email, email_action, event);

 

1 ACCEPTED SOLUTION

Remove this from your code

var link = current.getLink();

 

add below code

var link = gs.getProperty('glide.servlet.uri') + "sp?sys_id=" + current.getUniqueValue() + "&view=sp&id=ticket&table=incident";
 
Thanks,
Shakeel Shaik 🙂

View solution in original post

13 REPLIES 13

Maik Skoddow
Tera Patron
Tera Patron

Hi @Nitya 

unfortunately you did you say which portal and which page you want to have as link target, therefore I assume "/sp" as portal and "ticket" as page.

Use the following code line:

var link = gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=' + current.sys_class_name + '&sys_id=' + current.sys_id;

Kind regards
Maik

its still redirecting to native (itil) view incident only.. i updated code like below.

 

(function runMailScript(current, template, email, email_action, event) {
//var link = current.getLink();
var link = gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&table=' + current.sys_class_name + '&sys_id=' + current.sys_id;
if (email_action.name != "Incident Resolved") {
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print(gs.getMessage('You can view all the details of the incident by following the link below:'));
template.print('</font></p>');
} else {

Hi

 

var link = gs.getProperty('glide.servlet.uri') + "sp?sys_id=" + current.getUniqueValue() + "&view=sp&id=ticket&table=incident";

 

Please check and let me know

Thanks,
Shakeel Shaik 🙂

Still redirecting to itil view only... 😞