Email notifications.

saini
Tera Expert

In the email notification, I have this text in the body 'Order task Number: ${number} on order line number: ${order_line_item} is on hold and needs to be retriggered.'

 

how can I make this task number hyperlink and when clicked it should go to that particular task?

 

Thanks

1 ACCEPTED SOLUTION

Method 1:

PrasadDhumal_0-1674844824102.png

In your case, text should be:

 

Order task Number: ${URI_REF}

 

 

Method 2:

Not in email body, configure email script with name as "test_script".

(Never hardcode the instance name, use glide.servlet.uri

var URL= '<a href="' + gs.getProperty('glide.servlet.uri') + '/now/'+ current.getTableName() + '/' + current.sys_id + '">' + current.number + '</a>';
template.print(URL+ "<br />");

 

 

and in notification body, call that email script like this:

 

 

${mail_script:test_script} 

 

 

 

 

View solution in original post

5 REPLIES 5

Prasad Dhumal
Mega Sage
Mega Sage

Hello Saini,

To create a hyperlink in a notification that takes the user to the record whose number is clicked, you can use the following format:

 

https://instance_name.service-now.com/nav_to.do?uri=table_name.do?sys_id={sys_id}

 

  • Replace instance_name with the name of your ServiceNow instance
  • Replace table_name with the name of the table that the record belongs to
  • Replace {sys_id} with the sys_id of the record.

For Example:

 

https://myinstance.service-now.com/nav_to.do?uri=incident.do?sys_id=9c7d3f20dbd6f8c0dda11f7dca9619ed

 

This will create a hyperlink that, when clicked, will take the user directly to the incident record whose sys_id is "9c7d3f20dbd6f8c0dda11f7dca9619ed" in the incident table.

 

You can also use ${URI_REF} in the mail script to get the record link.

 

<a href="${URI_REF}">${number}</a>

 

This will create a hyperlink that, when clicked, will take the user directly to the record whose number is clicked.

 
Regards
Prasad

 

Method 1:

PrasadDhumal_0-1674844824102.png

In your case, text should be:

 

Order task Number: ${URI_REF}

 

 

Method 2:

Not in email body, configure email script with name as "test_script".

(Never hardcode the instance name, use glide.servlet.uri

var URL= '<a href="' + gs.getProperty('glide.servlet.uri') + '/now/'+ current.getTableName() + '/' + current.sys_id + '">' + current.number + '</a>';
template.print(URL+ "<br />");

 

 

and in notification body, call that email script like this:

 

 

${mail_script:test_script} 

 

 

 

 

This is working fine for me.

Order task Number: ${URI_REF}

{URI_REF} is working fine for me.