URL in an Email notification to portal view of a HR Task
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2021 02:30 AM
Hi
I want to add a link in an email notification for a HR Task that takes the user to the task in the HR Portal. I have found the ${URI} field but when you click on this it just takes you to the back end view. We don't want our colleagues using back end views we always direct them to the portal.
For standard cases we have had a email script built but I was wondering if there was a way we could do this without having to code.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2021 03:12 AM
You can utilize email scripts to have re-usable code to redirect users to portal also. We use this for all HR Case notifications to non-HR agents.
Assuming your HR Portal suffix is esc, here's code you can use. The resulting link will be the HR Task (or HR Case) number. Then in your notifications, just add the mail script name where you want it to display (e.g., ${mail_script:get_hr_task_esc_url})
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var url = 'esc?id=hrm_ticket_page&table=' + current.sys_class_name + '&sys_id=' + current.getUniqueValue(); //Builds URL without text value to display
template.print("<a href= '"+ url + "'>" + current.number + "</a>"); //Link text value = record #
})(current, template, email, email_action, event);