Dynamically changing the Reference Qualifier and updating the resulting records for a reference variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 02:28 PM
Hi all.
I am trying to update the options available for one reference variable on a catalog item based upon the currently selected value in a second reference variable on the same form.
Specifically, in Variable1 the user selects a type of phone to order and in Variable 2 are the cases that they can order with that phone. I want to be able to change the reference qualifier in Variable 2 (and have it recalculate the available cases) depending on what phone is selected. Both of these variables are reference variables to the Hardware Catalog table (Variable 1 is restricted to return only currently available phones).
I have tried using a script include as the reference qualifier but there seems to be no way to get the value of Variable1 to the script or any way to make Variable2 recalculate the list of available options.
I have created a script that will return the correct reference qualifier if it is supplied the sys_id of the phone selected I just can't seem to connect the pieces.
Any ideas would be greatly appreciated.
Thanks.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2017 02:58 PM
Try in reference qualifier of 2nd variable.
javascript:'Field_name_for_phone='+current.variables.variable_name_for_phone.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-06-2017 07:29 AM
Thanks for the response.
Unfortunately, this is a catalog item so the 'current' object is not available when the end user is actually filling it out so this won't work.
I have had limited success with:
javascript:new Include_Script_Object().Include_Script_Function('<sys_id of a phone in Variable 1>'));
If I hard-code the sys-id of a specific phone into the above Reference Qualifier for Variable2 then Variable2 correctly displays only the cases for the phone entered when the form loads.
That still leaves me with two problems:
1) How do I get the sys_id of Variable1 to Include_Script_Function (I have tried Include_Script_Function(g_form.getValue('Field_Name_For_Phone') with no success).
2) Even if I can get the sys_id of Variable1 into the Reference Qualifier, how do I get the Reference variable on the catalog item to update the selection list after the form has been loaded?
Again, any help would be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-18-2018 10:04 AM
This is working for me!
gdixon, I was able to use current.variables.start_date to reference a Date variable named [start_date] right on the catalog item submission form.
I do have one follow-up question for Deepak: have you ever needed to apply this to a list collector?
This approach seems to work perfectly for a single Reference variable in both the platform and portal views, but a list collector version of the Reference variable only appears to work in the portal (not in the platform).