Skip to main content
Known Participant
Aug 14, 2021 3:09 PM UTC
Question

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!

    4 replies

    stefanhelzle0001
    Brainy
    Aug 14, 2021 4:19 PM UTC

    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.

    Known Participant
    Aug 14, 2021 4:41 PM UTC

    Oh okay, thank you. 

    The selection of the organization would be the picker field.

    gopalk2865
    Participating Frequently
    Aug 14, 2021 7:09 PM UTC

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

    Participating Frequently
    Sep 28, 2021 7:41 AM UTC

    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.