- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2020 06:07 AM
I have a catalog item that includes a reference variable that is a list of all open onboarding request items. The user selects the request item they want to cancel. I want to display some of the data from the request item after the selection is made. I can select the fields that are part of the request item such as short description and due date, but I cannot figure out how to include some of the variable data such as employee termination date. I have code in a catalog client script that returns short description and due date, but employee termination date comes back as undefined. What do I do to retrieve the variable information? This is my code. I have tried 2 different ways to retrieve the term date. Thanks for your help.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var reqRITM = g_form.getReference("see_open_items", setValues);
function setValues(reqRITM){
g_form.setValue(open_short_description', reqRITM.short_description);
g_form.setValue(open_due_date', reqRITM.due_date);
g_form.setValue(open_term_date', reqRITM.term_date);
//also tried g_form.setValue(open_term_date', reqRITM.variables.term_date);
}
}
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2020 06:12 AM
You will have to use GlideAjax instead of getRef.
Refer to my article and you can do something similar with sc_req_item table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2020 06:12 AM
You will have to use GlideAjax instead of getRef.
Refer to my article and you can do something similar with sc_req_item table.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2020 06:15 AM
Get Reference won't return fields like variables, which are not on the actual record itself. You would need to use an GlideAjax call to send a request to the server and use a GlideRecord call to query the data and return it client-side.
As a tip, you can get the variable data by passing the sys_id of the RITM to your GlideAjax and doing a query something like this:
var sysID = '<your_ritm_sys_id>';
var RITM = new GlideRecord('sc_req_item');
RITM.get(sysID);
//Then you can access variables like this:
var term_date = RITM.varables.open_term_date;
Here are some GlideAjax examples:
Hope this helps!
If this was helpful or correct, please be kind and click appropriately!
Michael Jones - Proud member of the CloudPires Team!
Michael D. Jones
Proud member of the GlideFast Consulting Team!