How do I auto-populate one variable field, based on the selection from another?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2018 06:29 AM
Hi There,
I'm looking to auto populate a variable field on a catalog item, based on the choice selected on another variable from the same form.
Please see below the variables and what i'm trying to achieve.
Whatever is selected in 'What layer do you need access to?' i want it to then auto populate a choice in 'Group that will approve your request'.
the above feeds from the sys_user_group table
I have been looking at different Catalog client script (onChange), but as i'm not the greatest at scripting, i wanted to know if anyone has any ideas?
Thanks in advance.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2018 07:23 AM
Thanks ccajohnson, that's exactly what i'm after. I'm struggling with the 'put the sys_id of the expected groups into the value portion of the Choices of your Select Box variable' bit.
How do i do this?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2018 07:45 AM
You will need to find those groups you want to fill from the Select Box in the Groups [sys_user_group] table. Once you find a group, right-click on the name from the list and select Copy sys_id:
Then from your Select Box, open the appropriate Question Choice record. When in that record paste what you just copied from above into the value field:
Repeat for all choices for that Select Box. Then, after you have your onChange Catalog client script built it will set your reference variable accordingly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2018 06:40 AM
Thank you, that is very helpful. As you can tell I'm not the most technical. Last question, based on the script below
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
g_form.setValue('variable_name', newValue);
}
what needs to be edited here to make this work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-04-2024 04:56 PM
Hi Tom,
Did you figure out how to do this?
I have a very similar requirement and am struggling to find a straight forward answer on how to achieve this.
Mike