Prepopulating Data

I have a reference CDT for organization details. Here my requirements are when I select an organization name the tax id and address should be prepopulated. 

Is there any way to get this requirement done!

  Discussion posts and replies are publicly visible

  • 0
    Certified Lead Developer

    You did not write how you select the organization, but in general, in a saveInto you can fetch data based on entered data from any source and store it in a rule input or local and display it.

  • Oh okay, thank you. 

    The selection of the organization would be the picker field.

  • 0
    Certified Senior Developer
    in reply to gaddamv0001

    If you are using picker field then you can save the primary key of selected organization and using that you can query other information.

  • 0
    Certified Senior Developer

    a!localVariables(
    local!organisationName:cons!ST_LABEL_ORGANISATION_NAME,  
    local!organisationTaxID:cons!ST_ORGANISATION_TAXID_VALUES,
    local!organisationAddress:cons!ST_ORGANISATION_ADDRESS,
    
      
      {
      a!sectionLayout(
        label: "Section",
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!sideBySideLayout(
                    items: {
                      a!sideBySideItem(
                        item: a!dropdownField(
                          label: "Organisation Name",
                          labelPosition: "ABOVE",
                          placeholder: "--- Select a Value ---",
                          choiceLabels: {local!organisationName},
                          choiceValues: {local!organisationName},
                          value: ri!organisationName,
                          saveInto: {
                            ri!organisationName,
                            if(isnull(ri!organisationName),
                          {a!save(ri!organisationTaxID,null)
                          
                         },{}),
                          {a!save(ri!organisationTaxID,local!organisationTaxID),
                          if(isnull(ri!organisationName),
                          {a!save(ri!organisationAddress,null)
    
                          },{}),
                          {a!save(ri!organisationAddress,local!organisationAddress)
                          }
                          
                          
                          }},
                          searchDisplay: "AUTO",
                          validations: {}
                        )
                      )
                    }
                  ),
                  a!textField(
                    label: "Organisation Tax ID",
                    labelPosition: "ADJACENT",
                    value:{
                     ri!organisationTaxID
                    },
                    saveInto: {
                      ri!organisationTaxID
                    },
                    refreshAfter: "UNFOCUS",
                    readOnly: true,
                    validations: {}
                  )
                }
              ),
              a!columnLayout(
                contents: {
                  a!sideBySideLayout(
                    items: {
                      a!sideBySideItem(
                        item: a!floatingPointField(
                          label: "Donation Amount",
                          labelPosition: "ABOVE",
                          saveInto: {},
                          refreshAfter: "UNFOCUS",
                          validations: {}
                        )
                      )
                    }
                  ),
                  a!textField(
                    label: "Organisation Address",
                    labelPosition: "ADJACENT",
                    value:ri!organisationAddress,
                    saveInto: {ri!organisationAddress},
                    refreshAfter: "UNFOCUS",
                    readonly:true(),
                    validations: {}
                  )
                  
                }
              )
            }
          )
        }
      )
    })

    Here I used constants, instead of that use lookup tables and store values in the tables, query the data by using expression rules based on the primary key of the lookup tables.