Show/Hide Choices based of field selection

karlab
Tera Contributor

Hello,

 

Please show how to achieve the following. If I select "Architecturally significant" the only option to be displayed should be "NAS" if I select "NOT Architecturally significant" the only options displayed should be full or simplified. How do I achieve this?

 

 

karlab_0-1726664693648.png

 

1 ACCEPTED SOLUTION

This can be achieved using Catalog UI Policies by doing the following:

  1. Change "Refinement" and "Technical Governance Intake Path" to "Select Box" variable types and add the respective choices.
  2. Create a Catalog UI Policy named "Show technical governance intake path" with the conditions below and add the UI Policy Action to show the "Technical Governance Intake Path" variable (i.e., Visible is True)
         a. Refinement is Architecturally Significant OR Refinement is Not Architecturally Significant
  3. Create another Catalog UI Policy named "Architecturally significant choices" with the following script in "Execute if true":

    Screenshot 2024-09-18 at 10.46.01 AM.png

     

  4. Create another Catalog UI Policy named "Not architecturally significant choices" with the following script in "Execute if true":

    JordanVignoni_0-1726670869453.png

     

I completed this configuration in my PDI, and it displays the desired choices for each "Refinement" option (see below): 

Screenshot 2024-09-18 at 10.49.07 AM.png    Screenshot 2024-09-18 at 10.48.57 AM.png

View solution in original post

7 REPLIES 7

Zach Koch
Giga Sage
Giga Sage

You can do this with a UI policy. You would make the condition, when Architecturally Significant is true, then make the UI policy action for fields Simplified and Full make Hidden true.
For other Not Architecturally Significant is True, UI policy action for fields NAS make Hidden true.
On both of these make sure on the UI action that the Reverse if False checkbox is checked (it should be true by default), this will hide the fields if the UI conditions are false.

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

karlab
Tera Contributor

Can you show how to do this?  This is what I currently have

 

 

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading || newValue == '') {

    if (g_form.getValue('refinement') == 'Not Architecturally Signficant') {
g_form.setVisible('technical_governance' == "NAS", true);

} else {
g_form.setVisible('technical_governance' == "Full", false);
g_form.setVisible('technical_governance' == "Simplified", false);
}
      return;
   

Actually, if you are using multiple choice variable instead of radio buttons or Select Box, you can't hide individual values, as it will hide or show the entire multiple choice variable since the entire thing is considered one variable. You will need to convert it to radio buttons, or Select box like Jordan mentioned below.

This link may help you remove options from a select box

Add/Remove options from select box 

If this information helped resolve your issue, please remember to mark response correct and thumbs up to help future community members on this information, thanks!

karlab
Tera Contributor

I changed it to a select box, already. But this script does not work