Skip to main content
August 14, 2021
Question

Prepopulating Data

  • August 14, 2021
  • 4 replies
  • 0 views

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!

    4 replies

    stefanhelzle0001
    Brainy
    August 14, 2021

    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.

    August 14, 2021

    Oh okay, thank you. 

    The selection of the organization would be the picker field.

    gopalk2865
    Participating Frequently
    August 14, 2021

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

    September 28, 2021

    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.