Email Hyper link to Service Portal, Non ITIL users are redirected to the SP Incident View
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 11:23 AM
Hello Dev Community,
I have a email notification that is sent to end users, when a incident is open on their behalf. When the user click on the view incident they are redirected to the Service Portal landing page but the Incident. Is there way to have the user redirect to the Service portal Incident?
HTML body
Test: ${URI+&sysparm_scriptlet=current.getTableName() and current.sys_id}
Opened: ${opened_at}
Opened by: ${opened_by}
Short description: ${short_description}
Description: ${description}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 11:38 AM
You have to use a mail script to setup the URL properly. URI is the Standard UI link so when user who do have access get sent to the portal it just goes to the portal home page.
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
// Add your code here
var emailAddress = current.caller_id.email.toString().toLowerCase();
var url = '<a href="' + gs.getProperty('glide.servlet.uri') + 'sp?id=ticket&view=sp&table=' + current.getTableName() + '&sys_id=' + current.sys_id + '">' + current.number + '</a>'; //This is using the defualt Service poral name and page id. So you will need to verify if anything is different.
template.print("<span style='font-size:12pt;font-family:Arial, Helvetica, sans-serif;'>" + url + "</span>");
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 12:11 PM
Hello Brian,
I copied the code but the redirect is not working. Should I add the event that triggers the notification?
Thank you

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2024 12:27 PM
Where did you put the code? Normally you would add the code to a mail script and then call that mail script in the html body. So in place of here you have ${URI... you would put ${mail_script:mailscriptname}.