Trouble Getting Variables For A Notification

Alan42
Tera Guru

Complete newby here so please ignore my ignorance.    We have a termination workflow that has recently been updated to send out a notification to an HR admin group.    This new notification is sent out pre-approval when a checkbox indicating an emergency offboard is selected.    

 

Alan42_0-1692805458551.png

The workflow is working properly but I'm having trouble formatting the notification.   The user leaving the company is selected from a drop down or entered manually when an employee isn't in the list.    

 

Alan42_1-1692805699459.png

 

The notification fields available only give me options for the person opening the request, meaning 'requested for' gives me the HR persons name, not the person being terminated.   I've tried using field names but am clearly missing something in the syntax.   The link works and I can get the name of teh person opening the request and their location.    I can't get the departing employees name, the reason for leaving, or the date and time leaving.  Based on the screen shots below how would I find the correct syntax to use for teh fields pictured.    

 

Notification body

Click here to view Request: ${URI_REF}

Requested by: ${requested_for.first_name} ${requested_for.last_name}
Departing Employee:
Location: ${location}
Emergency Reason:
Termination date and time:

 

Variables

Alan42_2-1692806460662.png

Name manually selected (first_name, last_name structured the same)

Alan42_3-1692806649519.png

Name selected from a list

Alan42_4-1692806714430.png

Emergency Reason

Alan42_5-1692806817240.png

Termination date and time

Alan42_6-1692806871803.png

I think there is a prefix other than 'request_for' I should be using for each field but I've had no luck making sense out of what they should be.  I'm also not sure if there is a special 'display_value' command I should use to get the field contents rather than the title or how that works if that understanding is correct.        

 

 

2 ACCEPTED SOLUTIONS

Hemanth M1
Giga Sage
Giga Sage

Hi @Alan42 ,

 

Your almost there , use variables ex: for user name --> current.variables.requested_for.getDisplayValue() and so on... for other variables 

Accept and hit Helpful if it helps.

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

View solution in original post

Hi @Alan42 ,

I just saw your are trying to get in the email itslef then use as below

 

User Name: ${variables.requested_for}

 

 

Accept and hit Helpful if it helps.

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

View solution in original post

10 REPLIES 10

Hemanth M1
Giga Sage
Giga Sage

Hi @Alan42 ,

 

Your almost there , use variables ex: for user name --> current.variables.requested_for.getDisplayValue() and so on... for other variables 

Accept and hit Helpful if it helps.

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

Thank you so much.  That is exactly what I needed.  Your help is greatly appreciated.    

Hi @Alan42 ,

I just saw your are trying to get in the email itslef then use as below

 

User Name: ${variables.requested_for}

 

 

Accept and hit Helpful if it helps.

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

Hi Hemanth, 

 

I am facing similar issue in recalling variable from my service catalog, can you help?

I intend to include the service catalog item option "activity_date" to a automated notification.

The date variable wasn't available in [select variables]

 

However if I am creating an email notification in Flow Designer, I can choose the data pill from " Get Catalog Variables"   > "activity_date"

 

Thanks in advace!