How to create conditional checkbox ?

Hi Community,

 

How can i make checkbox visible/hidden based on previous DropDown value.

For ex - I have dropdown field as Product having values - KFC, Pizzahut.

I have different checkboxes values if user selects KFC or Pizzahut.

How can i show different checbox dynamically after user selects dropdwon value.

I don't want to show all checkbox value and then hide. Based on the choice KFC/Pizzahut corresponding Checkbox options should dynamically come in form.

Here is the code that i am trying. Please help me with this.

 

    if(
          ri!readOnly,
          a!textField(
            label: "Product",
            labelPosition: "ADJACENT",
            value: ri!record.productGroupAffected.value,
            readOnly: true
          ),
          a!dropdownField(
            label: "Product",
            labelPosition: "ABOVE",
            instructions: "",
            helpTooltip: "",
            placeholderLabel: "--- Select a Value ---",
            choiceLabels: local!productGroupAffectedOptions.value,
            choiceValues: local!productGroupAffectedOptions,
            value: ri!record.productGroupAffected,
            saveInto: ri!record.productGroupAffected,
            required: false
          )
        ),
        
	
		if(
			ri!record.productGroupAffected = "KFC",
			a!textField(
			label: "Tools Affected KFC",
			labelPosition: "ADJACENT",
			value: if(
					or(isnull(ri!record.toolsAffected), count(ri!record.toolsAffected.value)=0),
					"",
				joinarray(ri!record.toolsAffected.value, ", ")
			),
			readOnly: true
			),
			a!checkboxField(
			label: "Tools Affected KFC",
			labelPosition: "ABOVE",
			instructions: "",
			helpTooltip: "",
			choiceLabels: local!checkbox1Value,
			choiceValues: local!checkbox1Value,
			value: ri!record.toolsAffected,
			saveInto: ri!record.toolsAffected,
			required: false
			)
		),
		
		if(
			 ri!record.productGroupAffected = "PizzaHut",
			a!textField(
			label: "Tools Affected PizzaHut",
			labelPosition: "ADJACENT",
			value: if(
					or(isnull(ri!record.toolsAffected), count(ri!record.toolsAffected.value)=0),
					"",
				joinarray(ri!record.toolsAffected.value, ", ")
			),
			readOnly: true
			),
			a!checkboxField(
			label: "Tools Affected PizzaHut",
			labelPosition: "ABOVE",
			instructions: "",
			helpTooltip: "",
			choiceLabels: local!checkbox2Value,
			choiceValues: local!checkbox2Value,
			value: ri!record.toolsAffected,
			saveInto: ri!record.toolsAffected,
			required: false

			)
		),
		

  Discussion posts and replies are publicly visible