Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Parsing a record's field values in mail script (display field values in notification)

Thomas_J_C
Mega Expert

I'm currently creating a mail script to query a Task's related records and display those related record's fields in a determined format. 

Querying the records I need is no problem, however, how would I go about getting each related record object and parsing the fields to string values to display in a mail script?

I've used the JSON.parse() method before in record producer's however that was for a variable and not a record object.

I'll provide a screenshot for reference. 

find_real_file.png

1 ACCEPTED SOLUTION

Hi Thomas,

so you can print them in email using

template.print(gr.source_ip);

what issue you are facing?

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

9 REPLIES 9

Glad that it worked.

Could you also mark answer as helpful.

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

if I just want to print the value of the choice field how to do it?

I have used this and it is showing the label

template.print(current.getValue(u_contry));

Hi,

this would give you the choice value

template.print(current.getValue('u_contry'));

this would give you the choice label

template.print(current.u_contry.getDisplayValue());

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

template.print(current.getValue('u_contry'));

I am getting null 

Hi,

please post a new question and tag me.

This is an old thread so difficult to track

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 10x ServiceNow MVP  ||  ✨ ServiceNow Community Leader