Dotwalking in Notification

TStark
Kilo Sage

I'm not sure if this is possible, but I'm trying to dotwalk within a Notification to include a field from another table. The table in which the notification resides is the Demand [dmn_demand] table. The field which I'm trying to include in the notification is a field from the Stakeholder Register [dmn_stakeholder_register] table and this field is a custom field "u_level_team" that references the Group [sys_user_group] table. 

How is this achieved if possible.

Thanks,
AJ

1 ACCEPTED SOLUTION

Hemanth M1
Giga Sage
Giga Sage

Hi @TStark ,

 

you can add info in your email using Email script

Steps:

1)Create a email script 

fetch "u_level_team" by gliding m2m table i.e "dmn_m2m_demand_stakeholder"

var demand = new GlideRecord("dmn_m2m_demand_stakeholder");
demand.addQuery("demand", current.sys_id)
demand.query() //if its for one record
if(demand.next()){
template.print(demand.stakeholder.u_level_team.getDisplayValue());
}

2)Call this email script in your notification

like: ${mail_script:name of your email script}

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

View solution in original post

4 REPLIES 4

Hemanth M1
Giga Sage
Giga Sage

Hi @TStark ,

 

you can add info in your email using Email script

Steps:

1)Create a email script 

fetch "u_level_team" by gliding m2m table i.e "dmn_m2m_demand_stakeholder"

var demand = new GlideRecord("dmn_m2m_demand_stakeholder");
demand.addQuery("demand", current.sys_id)
demand.query() //if its for one record
if(demand.next()){
template.print(demand.stakeholder.u_level_team.getDisplayValue());
}

2)Call this email script in your notification

like: ${mail_script:name of your email script}

 

 

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

Hi Hemanth,

 

I tried the email script you've provided and I didn't get anything when I previewed the email notification. I did a test to see if any other field would work. I used the "number" field instead of the custom reference field in question: "u_level_team" and in the notification preview it returned the Stakeholder's number (STAK000...). Below is my mail script and a screenshot of the notification calling the mail script.

AJ27_0-1695669596166.png

AJ27_1-1695669732304.png

 

Hold that thought. Before I say your script doesn't work just by doing a preview, let me trigger the notification to test the mail script. I'll be back.

Hi @TStark ,

 

Did it work?? check you have "u_level_team" value in the preview record STAK000..

Accept and hit Helpful if it helps.

Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025