email notifications , adding multiple tables tasks

saini
Tera Expert

Hi ,

In email notification I want these two links to work and take the control to the appropriate records when clicked.

Order task Number: ${number} on Order Line Item: ${order_line_item} is on hold and needs to be retriggered

here task number and order line item belongs to different tables.

 

Thanks

2 REPLIES 2

Sai Shravan
Mega Sage

Hi @saini ,

 

You can create URLs that link to specific records in ServiceNow by using the "sys_id" of the record. The "sys_id" is a unique identifier for each record in a table.

 

In order to create a link to the task record, you can use the following format:

https://yourinstance.service-now.com/nav_to.do?uri=task.do?sys_id=${task_sys_id}

 

Similarly, in order to create a link to the order line item record, you can use the following format:

https://yourinstance.service-now.com/nav_to.do?uri=sc_req_item.do?sys_id=${order_line_item_sys_id}

 

You can then insert these URLs into the email notification template, replacing ${task_sys_id} and ${order_line_item_sys_id} with the appropriate sys_id values for the task and order line item records.

 

Replace 'yourinstance' with your actual instance name.

 

Example:

 

Order task Number: <a href='https://yourinstance.service-now.com/nav_to.do?uri=task.do?sys_id=${task_sys_id}'>${number}</a> on Order Line Item: <a href='https://yourinstance.service-now.com/nav_to.do?uri=sc_req_item.do?sys_id=${order_line_item_sys_id}'>${order_line_item}</a> is on hold and needs to be retriggered

 

It is also a good practice to validate sys_id and make sure it is not empty before creating the URL, to avoid any issues.

Regards,
Shravan.

Please mark it as the correct answer so that it may assist other users with similar inquiries in the future.

Regards,
Shravan
Please mark this as helpful and correct answer, if this helps you

Vishal Birajdar
Giga Sage

Hello Saini,

 

I'm assuming there should be link between Order task number and Order line item in your case.

As for me I don't have these two different tables so I'm taking Problem table and Incident Table to fit your scenario.

 

In My case lets assume,

Task Number = Problem Number

Order Line Item = Incident

As we know on incident form there is one reference field which reference to problem record. (See Screenshot below)

VishalBirajdar7_0-1674994607525.png

 

So you need to create two notification email scripts :

=====================================================================

1.Get_Problem_Number

 

VishalBirajdar7_1-1674994845519.png

========================================================================

2. Get_Incident_Number

 

VishalBirajdar7_2-1674994971015.png

==========================================================================

Now need to call these two email script on Email Notification,

 

VishalBirajdar7_3-1674995086585.png

 

================================================================================

When you preview this notification with Incident number below is the end Result :

VishalBirajdar7_4-1674995215891.png

 

 I hope this Solution will help you....!!!

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates