The CreatorCon Call for Content is officially open! Get started here.

Custom ${URI_REF} link not working

matthew_hughes
Kilo Sage

Within my workflow, I've specified an event that takes the user to a certain record in the 'sc_req_item' table if a request has been cancelled by specifying 'grEvent.uri' in the below code:

 

workflow issue screen 1.png

The below is my notification:

workflow issue screen 2.png

 

 However, when the email notification is generated, the ${URI_REF} instead takes the user to the 'sysapproval_approver' record, which is not what I want.

 

What do I need to do in my notification or workflow so that it takes the user to the URL specified in 'grEvent.uri' 

 

 

6 REPLIES 6

@matthew_hughes 

I hope you are aware on how to include email script in email body

${mail_script:mailScriptName}

Sample email script

(function runMailScript(current, template, email, email_action, event) {

	// Add your code here
	var taskID = current.sys_id;

	var tableName = 'sc_req_item'; // table name

	var instance_name = gs.getProperty('glide.servlet.uri');
	template.print('Click here to view the request online <a href="' + instance_name + tableName  +'&sys_id="' + taskID + '&view=sp' +  '">' + taskNum + '</a>');


})(current, template, email, email_action, event);

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Mohan Mallapu
Kilo Sage

@matthew_hughes  Can you try using ${document_id.URI_REF}