Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Mail script not working while trying to fetch GlideRecord from a non-task table using documet_id of approval record

rambo1
Tera Guru

var gr = new GlideRecord('u_capex_requests');

gr.get('sys_id', current.document_id);

template.print(gr.u_requestor_name);

tried this in mail script to get requestor name in email body, but it is not happening. Please suggest some alternatives to get requestor name in email body.

16 REPLIES 16

Use off.addQuery('sys_id',current.sys_id) or off.addQuery('number',current.number) or off.addQuery('number',current.getValue('number'))

 

If my answer helps you please accept the solution and hit the like button, it helps community members to contribute more.

Thanks

siva krishna M2
Tera Guru

Hello @rambo1 ,

 

Try below script

 

var gr = new GlideRecord('u_capex_requests');

gr.get('sys_id', current.document_id);

var k = gr.getValue('u_requestor_name');

template.print(k.toString())