How to autopopulate fields in an interface?

Scenario:Suppose there are 3 fields(A,B,C). Field  A is a custompicker, i want to autopopulate B & C fields on selecting the value in field A. How is it possible,Please help.

Basically, i have created an integration to get details from API, then i am fetching A,B,C fields from the response using expression rule.and then saving them into Datastore using a!writeToDataStore(). Now i want an interface in which if i select value in A field, B& C should autopopulate with the values saved in datastore. or if there is any other approach of getting the value directly from API.

  Discussion posts and replies are publicly visible

Parents
  • I think you can achieve what you are trying to do by using a!refreshVariable() and the parameter "refreshOnVarChange". Here is simple example of what it sounds like you are trying to do:

    a!localVariables(
      local!b: a!refreshVariable(
        value: rule!getValueForB(),
        refreshOnVarChange: ri!a
      ),
      local!c: a!refreshVariable(
        value: rule!getValueForC(),
        refreshOnVarChange: ri!a
      ),
      {
        a!dropdownField(
          label: "a",
          value: ri!a,
          saveInto: ri!a,
          choiceLabels: {1, 2, 3},
          choiceValues: {1, 2, 3}
        ),
        a!textField(
          label: "b",
          value: local!b,
          readOnly: true
        ),
        a!textField(
          label: "c",
          value: local!c,
          readOnly: true
        )
      }
    )

Reply
  • I think you can achieve what you are trying to do by using a!refreshVariable() and the parameter "refreshOnVarChange". Here is simple example of what it sounds like you are trying to do:

    a!localVariables(
      local!b: a!refreshVariable(
        value: rule!getValueForB(),
        refreshOnVarChange: ri!a
      ),
      local!c: a!refreshVariable(
        value: rule!getValueForC(),
        refreshOnVarChange: ri!a
      ),
      {
        a!dropdownField(
          label: "a",
          value: ri!a,
          saveInto: ri!a,
          choiceLabels: {1, 2, 3},
          choiceValues: {1, 2, 3}
        ),
        a!textField(
          label: "b",
          value: local!b,
          readOnly: true
        ),
        a!textField(
          label: "c",
          value: local!c,
          readOnly: true
        )
      }
    )

Children