Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

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 🙂

Thanks Nitya 🙂

Thanks,
Shakeel Shaik 🙂

could you help me for this as well , its also redirecting to  itil view .

 

Your Incident ${number} has been updated with new comments. Your reply to this email will be captured in the incident.

Short description: ${short_description}
Click here to view: ${URI_REF}
<hr/>
Additional Comments:
${comments}

 

 

I think, here in Notification, we can't achieve.

you need to create email script

Thanks,
Shakeel Shaik 🙂