- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2016 03:59 PM
Have a record producer set up with Approver field populated with a catalog client script containing:
function onChange(control, oldValue, newValue, isLoading) {
var dept = g_form.getReference("u_requestordept");
var dbo = dept.PrimeContact;
g_form.setValue("u_deptapprover", dbo);
}
The approver's name shows up on the form but not in the table's u_deptapprover field after the submit.
Added this code to the "What it will contain" script:
current.u_deptapprover= producer.u_deptapprover.getDisplayValue();
But still nothing appears in the table field. If I set the table field to be type string, the approver's name shows up. Not so with a reference field.
How do I set the table reference field with the value in the form?
Or, what do I need in the script to load the original reference field vale to the table?
Solved! Go to Solution.
- 6,757 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2016 06:10 PM
When both fields are of reference type, it should be
current.u_deptapprover= producer.u_deptapprover;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2016 06:10 PM
When both fields are of reference type, it should be
current.u_deptapprover= producer.u_deptapprover;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2016 12:59 PM
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2016 06:38 PM
Hi Glenn,
The getDisplayValue() function will return the column label of the field that has been set as Display = true in the dictionary entries on the referenced table.
This will normally be set out of the box for ServiceNow tables but you have to set it yourself if/when you create a custom table.
Do this;
1. Open the table you are referencing in "configuration mode"
Look at the Display value column and set the value to true for the column label you would like to be used as the value to appear in the reference field;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-31-2016 12:59 PM
Thank you.