- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2019 03:26 AM
Mail script:-
(function runMailScript(current, template, email, email_action, event) {
template.print(current.variables.property_authorization_card.Type+ '\n\n'+"<br/> Property card Details");
})(current, template, email, email_action, event);
here issue is it provide me the sys id of Type. How to populate name instead of sys id.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2019 05:08 AM
search on google , you will find plenty of reference regarding the style .
try with below code.
(function runMailScript(current, template, email, email_action, event) {
var arr =[];
var variableArray = JSON.parse(current.variables.property_authorization_card);
for(var i=0; i < variableArray.length; i++) {
var gr = new GlideRecord('table name');
gr.addQuery('sys_id','IN',variableArray[i].Type);
gr.query();
gs.log('Row count'+ gr.getRowCount());
while(gr.next()){
arr.push(gr.name);
}
}
template.print(arr+ '\n\n'+"<br/> Property card Details");
})(current, template, email, email_action, event);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2019 05:07 AM
Hi Kun
You should start learning to write a simple glide Record script mate, so that you can do your own work and get paid for it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2019 05:08 AM
search on google , you will find plenty of reference regarding the style .
try with below code.
(function runMailScript(current, template, email, email_action, event) {
var arr =[];
var variableArray = JSON.parse(current.variables.property_authorization_card);
for(var i=0; i < variableArray.length; i++) {
var gr = new GlideRecord('table name');
gr.addQuery('sys_id','IN',variableArray[i].Type);
gr.query();
gs.log('Row count'+ gr.getRowCount());
while(gr.next()){
arr.push(gr.name);
}
}
template.print(arr+ '\n\n'+"<br/> Property card Details");
})(current, template, email, email_action, event);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2019 03:32 AM
Hi,
Try adding getDisplayValue() after Type.
If my answer helped you in any way, please then mark it as helpful. If this solved your case please mark it as correct answer. Thank You.
Best regards,
Łukasz
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2019 03:49 AM
after adding getdisplayvalue, it provide me "undefined"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2019 03:59 AM
Have you ensured that names of the fields and also the getDisplayValue() is ok, no typo, no big letters instead of small and no small letters instead of bid? Java Script is Case Sensitive so it must be written exacly the same way like it was created.
Also what type of object is current? Is it a RITM?