How to populate a variable depending on selection of choice list in another variable?

Arjun Reddy Yer
Tera Guru

Can anyone help me to populate a variable depending on selection of choice list in another variable of a catalog item. @Ankur Bawiskar @Community Alums @Mark Roethof @asifnoor @Amit Gujarathi @Gunjan Kiratkar @RaghavSh 

One variable is created as mentioned below screen shot

yerasumalli_0-1673456788503.png

In the below mentioned screen shot once user select the highlighted option 

yerasumalli_1-1673456892279.png

Then the below mentioned variable must populate

yerasumalli_2-1673456947107.png

 

1 ACCEPTED SOLUTION

Ahh I have misunderstood. A catalog UI policy would work for this:

When to apply: Select Type of Risk Assessment is Vendor Security Assessment (VSA)

Ensure "Reverse if false" is selected

Save record

 

set UI policy to set vendor_contact_name's visibility to "true"

 

Would look similar to this when completed with your variable names:

mattystern_0-1673466093580.png

 

View solution in original post

5 REPLIES 5

mattystern
Kilo Sage

Hi Yerasumalli,

 

Seems like a catalog client script would do here:

Type: On Change

Variable Name: Vendor Security Assesmenet (VSA)

Here's some  untested psudocode:

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {
      return;
   }
	if(newValue == "Vendor Security Assessment (VSA)"){ //set to value of select box
	g_form.setValue("vendor_contact_name", "whatever text you want to populate"); //set value to text you want to populate
	}
   
}

 

 

 -Matt

There is no any text to populate as the user needs to enter name as the "vendor_contact_name" is text filed.

So, now what should I need to do at the "whatever text "

g_form.setValue("vendor_contact_name", "whatever text you want to populate");

 

and the filed is visible before selecting the Variable Name: Vendor Security Assesmenet (VSA)

 

 

Yera,

 

I may have misunderstood. Is this the correct requirements?

 

1. User selects option from "Select Type of Risk Assessment"

2. If user selects the option "Vendor Security Assessment (VSA)" then populate text field ("whatever text you want to populate")

3. If user selects another option, user populates text field 

 

-Matt

1. User selects option from "Select Type of Risk Assessment"

2. If user selects the option "Vendor Security Assessment (VSA)" then variable (vendor_contact_name) must populate and it's just text field.

3. If user selects another option, then the variable must not display.

 

what should I need to do