- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 05:27 AM
Hello Everyone,
I want to populate a field name which is present on u_bsa table.
On u_bsa table i field named as Req for which was dot walk by sc_req_item table, i want to display that Req for field name for which i written a script like below
i am getting a display value as undefined
var ritm = new GlideRecord('u_bsa');
if(ritm.get(current.sysapproval)){
var req_for = ritm.u_requested_for.name; //Output i am getting is undefined
var ge = ritm.u_requested_item.number; // I am getting correct output here
gs.addInfoMessage(req_for);
gs.addInfoMessage(ge);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 06:10 AM
Try
var req_for = ritm.u_requested_item.u_requested_for.getDisplayValue()
Manish

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 05:48 AM
Thank you. Your description said you were looking to dot-walk in a business rule.
Which table does the notification use (to better understand what current refers to)?
Am I correct in assuming that u_requested_for is a reference field to sys_user and u_requested_item is a reference to sc_req_item?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 05:53 AM
Sorry it was a TYPO
Notification uses Approval table
Yes your assumption is correct,
u_requested_for is a reference field in RITM table which is referring to user table & u_requested_item is a reference to sc_req_item.
I dot walk using form layout and populated Requested for name in u_bsa from RITM table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 06:03 AM
I know it's not going to matter much, but have you tried this instead:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var ritm = new GlideRecord('u_bsa');
gs.addInfoMessage('current.sysapproval=' + current.getValue('sysapproval'));
if (ritm.get(current.getValue('sysapproval'))) {
var req_for = ritm.u_requested_for.getDisplayValue();
var ge = ritm.u_requested_item.getDisplayValue();
gs.addInfoMessage(req_for);
gs.addInfoMessage(ge);
template.print("" + ritm.u_requested_for.getDisplayValue());
//template.print(req_for);
}
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 06:39 AM
I tried with your code but unable to get the req for name
Chuck,
Same code was working when i try to for RITM table:
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
// Add your code here
var ritm = new GlideRecord('sc_req_item');
if(ritm.get(current.sysapproval)){
var req_for = ritm.u_requested_for.name;
template.print(""+ritm.u_requested_for.name);
}
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2017 07:02 AM
Chuck,
I tried with below script and it works:
var req_for = ritm.u_requested_item.u_requested_for.getDisplayValue();
Thanks for all your help