How do I auto-populate one variable field, based on the selection from another?

tom_hs2
Kilo Contributor

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.

find_real_file.png

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'.

find_real_file.png

find_real_file.png

 

find_real_file.png

find_real_file.png

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.

 

 

 

 

 

8 REPLIES 8

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?

ccajohnson
Kilo Sage

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:

find_real_file.png

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:

find_real_file.png

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.

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?

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