
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2020 01:38 PM
Hello,
I'm trying to populate a reference field in a table using a business rule. OOB checklist macro--the one that controls what values go into the checklist_item record--only works on the task table.
I'm struggling to dot-walk and query a Document ID field from the checklist_item table to the checklist table.
var gr = new GlideRecord('checklist');
gr.addQuery('checklist_item.checklist.document','sys_id'); //Document ID field.
gr.query();
if (gr.next()) {
current.u_number = gr;
}
Thank you.
Desmo
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2020 01:51 PM
Hey,
use .getRefRecord();
for ex :
var myDoc = current.checklist.getRefRecord();
current.u_number = myDoc.document + "";
No need to use GlideRecord this way
Cheers,
Joro

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2020 01:50 PM
Update your code like below
var gr = new GlideRecord('checklist_item');
gr.addQuery('checklist.document',current.sys_id); //Document ID field.
gr.query();
if (gr.next()) {
current.u_number = gr.<FIELD_FROM_CHECKLIST_TABLE>;
}
Regards,
Sachin
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2020 01:51 PM
Hey,
use .getRefRecord();
for ex :
var myDoc = current.checklist.getRefRecord();
current.u_number = myDoc.document + "";
No need to use GlideRecord this way
Cheers,
Joro