Can I gray out the fields of other variables when a value is entered for one variable?

Ryota
Tera Guru

When I order the service catalog, if only one of the three variables is entered, the other two variables do not need to be entered, so I would like to gray them out. Is there a way to set this?

1 ACCEPTED SOLUTION

Ratnakar7
Mega Sage
Mega Sage

Hi @Ryota ,

 

UI Policies allow you to dynamically control the visibility and read-only state of form fields based on specified conditions.

Here's how you can set up a UI Policy to gray out fields when a value is entered for one variable while leaving the other fields editable:

 

  1. Create a new UI Policy.
  2. Provide a name and description for the UI Policy.
  3. Define the condition for when the UI Policy should be applied. For example, if you have a variable named "Variable A" and you want to gray out "Variable B" and "Variable C" when "Variable A" has a value, the condition could be: current.variables.variable_a != '' (adjust the condition based on your actual variable names).
  4. Under the "Advanced" section, choose the action "Set Read-only" for the fields you want to gray out (e.g., "Variable B" and "Variable C").

After saving the UI Policy, whenever a value is entered for "Variable A" in the service catalog form, "Variable B" and "Variable C" will be grayed out and set to read-only, indicating that they do not need to be entered.

 

Thanks,

Ratnakar

View solution in original post

2 REPLIES 2

Ratnakar7
Mega Sage
Mega Sage

Hi @Ryota ,

 

UI Policies allow you to dynamically control the visibility and read-only state of form fields based on specified conditions.

Here's how you can set up a UI Policy to gray out fields when a value is entered for one variable while leaving the other fields editable:

 

  1. Create a new UI Policy.
  2. Provide a name and description for the UI Policy.
  3. Define the condition for when the UI Policy should be applied. For example, if you have a variable named "Variable A" and you want to gray out "Variable B" and "Variable C" when "Variable A" has a value, the condition could be: current.variables.variable_a != '' (adjust the condition based on your actual variable names).
  4. Under the "Advanced" section, choose the action "Set Read-only" for the fields you want to gray out (e.g., "Variable B" and "Variable C").

After saving the UI Policy, whenever a value is entered for "Variable A" in the service catalog form, "Variable B" and "Variable C" will be grayed out and set to read-only, indicating that they do not need to be entered.

 

Thanks,

Ratnakar

Hi @Ratnakar7 

Thank you for your quick reply. I solved it successfully.