URL in an Email notification to ESC view of an Approval Task

Linda6
Mega Guru

Dear community,

I'm struggling in finding out how to direct the users who receive an approval notifications to be directed to the ESC view of the approval instead to the backend.

I came across these two articles which were helpful:

URL in an Email notification to portal view of a HR Task 

How to set up email notifications to point to the Service Portal instead of the Platform UI 

 

However, my concern is that when the user clicks on the button to Take me to my Approval, it directs to the ESC, but only to the general view of the To-dos widget (hrm_todos_page), but not the specific approval task/request:

 

Where it directs now:

situationnow.png

 

Desired state would be to open directly the given approval request (in this case it is CHG0030195):

 

situationdesired.png

 

The email script I'm using is as follows:

 

 

 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {

	var url = '<a href="' + 'esc?id=hrm_todos_page&table=' + current.sys_class_name + '&sys_id=' + current.sys_id + '">Take me to the Approval</a>';

	//template.print("<a href= '"+ url + "'>" + current.number + "</a>"); 
	template.print(url);
		
})(current, template, email, email_action, event);

 

 

 

Can you please help me in correcting my script, so it would direct the user straight to the desired approve request?

 

Thank you and kind regards,

 

Linda

 

15 REPLIES 15

tim2222
Mega Guru

For anyone finding this post the answer is in this community post (tested in Zurich):

https://www.servicenow.com/community/employee-center-forum/how-to-show-current-approval-request-in-m...

 

Use the todo parameter with the sys_id of the task you want to show e.g. /esc?id=hrm_todos_page&todo=abcd1234...