- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2022 01:56 PM
Hi everyone ,
I have This below email script to navigate the Tasks to the Service portal when clicked on email notification. For The Agents who work from the Workspace wants that link to navigate to workspace.
I wrote this script to navigate to HRM to-do summary page. Can any one help how can i make modifications so that it navigates to specific record on agent workspace & If it is IT ticket then should go IT Agent workspace and if it is HR then HR agent workspace.
Thanks.
Here is the script i used
var recordClass = current.sys_class_name;
var sysID = current.sys_id;
var ticketPage = '';
if (recordClass.indexOf('sn_hr_') > -1){
ticketPage = 'hrm_ticket_page';
} else {
ticketPage = 'ticket';
}
var recordURL = "/sr?id=" + ticketPage + "&table=" + recordClass + "&sys_id=" + sysID;
template.print('<strong><font size="3" color="#000000" face="helvetica"><a href="' + recordURL + '">' + current.getValue("number") + '</a></font></strong>\n');
})(current, template, email, email_action, event);
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2022 08:31 PM
Hi,
You can update URL line like below:
var recordURL = "/sr?id=" + ticketPage + "&table=" + recordClass + "&sys_id=" + sysID;
var recordClass = current.sys_class_name;
var sysID = current.sys_id;
// cooment below 6 lines if not required
var ticketPage = '';
if (recordClass.indexOf('sn_hr_') > -1){
ticketPage = 'hrm_ticket_page';
} else {
ticketPage = 'ticket';
}
var recordURL = "/now/workspace/agent/record/" + recordClass + "/" + sysID; // update this line only
template.print('<strong><font size="3" color="#000000" face="helvetica"><a href="' + recordURL + '">' + current.getValue("number") + '</a></font></strong>\n');
Thanks
Anil Lande
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2022 08:29 PM
Hi,
You need to replace your line highlighted below to the modified one:
Current Line:
var recordURL = "/sr?id=" + ticketPage + "&table=" + recordClass + "&sys_id=" + sysID;
Modified Line:
var recordURL = "/now/workspace/agent/home";
I do not have HR Agent Workspace installed in my PDI, but you can open the HR Workspace module and then just replace it after now.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2022 11:28 AM
This one worked too..!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-01-2022 11:30 AM
Hi
Glad that it worked for you. I think by mistake you have marked your own answer as correct.
Can you please mark my answer as correct and close this thread for others.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2022 08:31 PM
Hi,
You can update URL line like below:
var recordURL = "/sr?id=" + ticketPage + "&table=" + recordClass + "&sys_id=" + sysID;
var recordClass = current.sys_class_name;
var sysID = current.sys_id;
// cooment below 6 lines if not required
var ticketPage = '';
if (recordClass.indexOf('sn_hr_') > -1){
ticketPage = 'hrm_ticket_page';
} else {
ticketPage = 'ticket';
}
var recordURL = "/now/workspace/agent/record/" + recordClass + "/" + sysID; // update this line only
template.print('<strong><font size="3" color="#000000" face="helvetica"><a href="' + recordURL + '">' + current.getValue("number") + '</a></font></strong>\n');
Thanks
Anil Lande
Thanks
Anil Lande