How to create a link in a workflow notification

Community Alums
Not applicable

Hi ,

 

I am trying to create a link in a workflow notification, for this I have tried the below email script in Workflow notification but it did not work.

<mail_script>

var gr = new GlideRecord('u_request_item');

gr.addQuery('sys_id',current.u_document_id);
gr.query();
if(gr.next())

{

template.print("Request ID : " +<a href="myinstance.service-now/nav_to.do?uri=u_request_item.do?sys_id=${gr.sys_id}">${gr.number}</a> +'\n');

}

</mail_script>

If it is wrong, help me with it.

1 ACCEPTED SOLUTION

Your quotations (") are all messaged up in your template.print line. Try fixing that and it should be good. I recommend putting your script in a script editor (script field) so you can see any syntax errors.

View solution in original post

5 REPLIES 5

Community Alums
Not applicable

Hi Mike ,

 

Thanks for the Response.

But I was already having a Notification activity in Workflow with email script , in which it will trigger notification based on the kind of request ,  now I am just trying to input a link of the Request Item of one type , also a kb article link .

Could you please let me know how can these be achieved in Notification activity in Workflow

What table is the workflow running from? 

Also which table are you trying to query? I see 'u_request_item' in the GlideRecord. Did you mean 'sc_req_item'?

Community Alums
Not applicable

Workflow is running on a custom table lets says the Table name be  u_Table and we have another custom Task Table u_request_item , now I have queried here the table u_request_item and trying to have the custom Task record as a link in the workflow notification activity.