Email Script: Navigate Link on email to HR agent workspace instead of Servicenow Portal

Kachu
Kilo Sage

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);
1 ACCEPTED SOLUTION

Anil Lande
Kilo Patron

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

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

View solution in original post

6 REPLIES 6

I will try this . Thank you.

rcard11
Tera Guru

I just created an idea for this same issue.  There really should be an OOTB way to do this.  If you want to vote up:  Notification links for Agent Workspace