How to configure links in email script? it has to redirect to front end portal for an end user and to backend for an itil user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2019 03:21 AM
Hello,
There is a link given in the notification body.
The requirement is when an end user clicks on the link it should redirect to the front end portal and when an itil user clicks on the same link, it should redirect to the backend.
How can i configure the link in email script?
When i open a ticket in front end, the url is in this form :
Can someone help me in configuring this link in email script?
Regards,
Reeba
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2019 03:29 AM
You should be able to give the same URL to everyone, there is a script include called SPEntryPage that controls whether a user is redirected to the service portal or the frameset page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2019 03:39 AM
Hello David,
Actually when a ticket is created, a notification needs to be sent with the details of the ticket created.
And in that notification there should be a link which would direct the users to the ticket in frontend portal if they are end user and to the backend if tehy are itil users.
That should be done using email scripts right?
Regards,
Reeba
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2019 03:51 AM
If you look at the OOB mail script called 'incident_take_me_to_the_incident' you can see current.getLink() is used in there so that's one option.
Another option is to construct the URL something like:
template.print('<a href="' + gs.getProperty('glide.servlet.uri') + gs.generateURL(current.getTableName(), current.getUniqueValue()) + '">' + current.number + '</a>';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2019 03:46 AM
Hi,
As David Suggested, the OOB SN will take care of the redirction. But if you still wnat to do this with the email script, try this code.
displayLinks();
function displayLinks() {
//Check if the user has role itil
if (gs.hasRole("itil")) {
var displayLink = 'your_backend_link';
} else {
var displayLink = 'your_portal_link';
}
template.print(displayLink + "<br />");
}
Mark the comment as a correct answer and also helpful once worked.