Mail script not working while trying to fetch GlideRecord from a non-task table using documet_id of approval record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 05:42 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 05:49 AM
Hi Rohith,
Try the below:
var gr = new GlideRecord('u_capex_requests');
gr.addQuery('sys_id', current.document_id);
gr.Query();
while(gr.next()){
template.print(gr.u_requestor_name);.
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2017 05:18 AM
Tried, not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-03-2017 05:52 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-04-2017 06:24 AM
Do not understand how can this be tested in background. The mail script takes relevant approval's document_id which is sys_id of the original ticket.
If I put sys_id in place of current.document_id inbackground script it certainly works. I have also tested that the document_id is puts out correct value.
The issue I found is that Glide script not working in that email script. If I just query a table and try to print getRowCount(), it prints 0.
Is there any method to find out why Glide script not working in mail script ? I have tried Debug already could not understand anything.
I tried the same code in my personal instance and it works pefectly to fetch the details of original ticket using approval's document_id.