dropdown

Hi,

I have a dropdown with 2 values.

I have a scenario like once after selecting "Cancelled" I have to show a textfield to enter comments and save the details. This I am able to achieve.

But, at the same time I have to remove "Cancelled" option from the dropdown. When I am trying to do that I can getting below specified error.

ERROR:

code:

  Discussion posts and replies are publicly visible

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to Hari Kishore Reddy

    There are couple of issues in your code. First you are appending null values to your dropdown list. Second,  your save logic is conflicting with you local variable dropdown logic list. Try this code it will work for your case

    a!localVariables(
      local!reviewOptionLables: if(
        ri!opinionData.RequestStaus = "PA",
        {"Additional Info Required", "Cancelled"},
        {"Additional Info Required"}
      ),
      local!reviewOptionValues: if(
        ri!opinionData.RequestStaus = "PA",
        {"AIR", "CED"},
        "AIR"
      ),
      local!selectedReviewOption,
      
      
      
      
      
      a!formLayout(
        contents: {
          a!dropdownField(
            label: "Review Options",
            placeholder: "-- Review Options --",
            choiceLabels: local!reviewOptionLables,
            choiceValues: local!reviewOptionValues,
            value: local!selectedReviewOption,
            saveInto: {
              local!selectedReviewOption,
              ri!opinionReviewOption, /*Assuming this is where you are saving final selection */
              /*Resetting your reason every time option is changed*/
              a!save(
                ri!reason,
                null
              )
            }
          ),
          a!textField(
            showWhen: ri!opinionReviewOption = "Cancelled",
            label: "Reason",
            value: ri!reason,
            saveInto: {
              ri!reason,
          /* Not sure where you have this save logic in your code - Take this logic and place in your code whre appropriate*/
              a!save(
                local!selectedReviewOption,
                null
              ),
              a!save(
                ri!opinionData.RequestStaus,
                if(
                  ri!opinionReviewOption = "AIR",
                  "PA",
                  if(
                    ri!opinionReviewOption = "CED",
                    "CA",
                    ""
                  )
                )
              )
            }
          )
        }
      )
    )