Want to preload editable grid having Dropdown values with file upload .

Actually I am having editable grid which is shown below .. contains components  dropdown and  file upload field and Text Field 

I want to preload the required values of dropdown , when user opens the page he should see the grid with selected dropdown values. as shown below 

all other functionality of grid will work as it is .. like removing adding new row .. 

please find the code-snipet attached (in the snipet Local!required Documents .. is just an id label we are storing in lookupref Table  so we can get from there)

  local!selectedDocuments: if(
    a!isNullOrEmpty(local!data),
    {
      'recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents'()
    },
    local!data
  ),
  
  local!requiredDocuments:{198,199,191,193},




a!gridLayout(
          label: "",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Document Type"),
            a!gridLayoutHeaderCell(label: "Document"),
            a!gridLayoutHeaderCell(label: "Description"),
            a!gridLayoutHeaderCell(label: "Remove")
          },
          columnConfigs: {
            a!gridLayoutColumnConfig(),
            a!gridLayoutColumnConfig(),
            a!gridLayoutColumnConfig(),
            a!gridLayoutColumnConfig(width: "ICON")
          },
          rows: {
            a!forEach(
              items: local!selectedDocuments,
              expression: a!gridRowLayout(
                contents: {
                  a!dropdownField(
                    placeholder: "Select Document Type",
                    choiceLabels: if(
                      local!documentType,
                      property(
                        local!choicevalues,
                        'recordType!{678c67a1-267c-432d-81f9-7d90a0e6925e}PRO Lookup.fields.{9b08548e-5e40-41e6-a600-39e36f53bd2d}label',
                        {}
                      ),
                      property(
                        local!documentLookupValues,
                        'recordType!{678c67a1-267c-432d-81f9-7d90a0e6925e}PRO Lookup.fields.{9b08548e-5e40-41e6-a600-39e36f53bd2d}label',
                        {}
                      )
                    ),
                    choiceValues: if(
                      local!documentType,
                      property(
                        local!choicevalues,
                        'recordType!{678c67a1-267c-432d-81f9-7d90a0e6925e}PRO Lookup.fields.{90e98305-1db5-4c60-94f2-766a530e0dd3}lookupRefId',
                        {}
                      ),
                      property(
                        local!documentLookupValues,
                        'recordType!{678c67a1-267c-432d-81f9-7d90a0e6925e}PRO Lookup.fields.{90e98305-1db5-4c60-94f2-766a530e0dd3}lookupRefId',
                        {}
                      )
                    ),
                    value: if(
                      a!isNullOrEmpty(
                        fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{5312c731-e8d4-4eed-87e1-0447536d6e4d}leadDocumentLookupRefId']
                      ),
                      local!documentLookupRefIds,
                      fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{5312c731-e8d4-4eed-87e1-0447536d6e4d}leadDocumentLookupRefId']
                    ),
                    saveInto: {
                      a!save(
                        fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{5312c731-e8d4-4eed-87e1-0447536d6e4d}leadDocumentLookupRefId'],
                        save!value
                      ),
                      a!save(
                        fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{1056ba0c-3a49-4e35-80f4-a8be3e97890c}documentName'],
                        rule!OCO_findCDTbyAnyField(
                          cdts: local!documentLookupValues,
                          where: 'recordType!{678c67a1-267c-432d-81f9-7d90a0e6925e}PRO Lookup.fields.{90e98305-1db5-4c60-94f2-766a530e0dd3}lookupRefId',
                          equals: save!value,
                          select: 'recordType!{678c67a1-267c-432d-81f9-7d90a0e6925e}PRO Lookup.fields.{9b08548e-5e40-41e6-a600-39e36f53bd2d}label'
                        )
                      ),
                      if(
                        fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{5312c731-e8d4-4eed-87e1-0447536d6e4d}leadDocumentLookupRefId'] = cons!PRO_LEAD_DOCUMENT_TYPE_OPERATING_OR_STATE_LICENSE,
                        {
                          a!save(
                            local!countOSL,
                            tointeger(sum(1, local!countOSL))
                          )
                        },
                        {}
                      ),
                      if(
                        fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{5312c731-e8d4-4eed-87e1-0447536d6e4d}leadDocumentLookupRefId'] = cons!PRO_LEAD_DOCUMENT_TYPE_CERTIFICATE_OF_GENERAL_AND_PROFESSIONAL,
                        {
                          a!save(
                            local!countCOG,
                            tointeger(sum(1, local!countCOG))
                          )
                        },
                        {}
                      ),
                      if(
                        fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{5312c731-e8d4-4eed-87e1-0447536d6e4d}leadDocumentLookupRefId'] = cons!PRO_LEAD_DOCUMENT_TYPE_CERTIFICATE_OF_ACCREDITIATION,
                        {
                          a!save(
                            local!countCOA,
                            tointeger(sum(1, local!countCOA))
                          )
                        },
                        {}
                      ),
                      a!save(
                        ri!countOperatingLicense,
                        local!countOSL
                      ),
                      a!save(ri!countCertificate, local!countCOG),
                      a!save(
                        ri!countCertificateOfAccrediation,
                        local!countCOA
                      ),
                      a!save(
                        ri!requiredDocuments,
                        local!requiredDocuments
                      )
                    },
                    searchDisplay: "AUTO",
                    required: true
                  ),
                  a!fileUploadField(
                    label: "",
                    labelPosition: "COLLAPSED",
                    target: a!defaultValue(
                      local!folder,
                      cons!PRO_FOLDER_LEAD_DOCUMENTS_ATTACHMENTS
                    ),
                    maxSelections: 1,
                    value: if(
                      a!isNullOrEmpty(fv!item),
                      "",
                      fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{42dfb404-4221-4f95-ba73-314e2f21a0b7}documentId']
                    ),
                    saveInto: if(
                      a!isNotNullOrEmpty(
                        fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{30b4e4c0-70b2-4a92-9731-e37a96666060}leadDocumentId']
                      ),
                      {
                        a!save(
                          ri!deletedDocuments,
                          append(
                            ri!deletedDocuments,
                            todocument(
                              fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{42dfb404-4221-4f95-ba73-314e2f21a0b7}documentId']
                            )
                          )
                        ),
                        fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{42dfb404-4221-4f95-ba73-314e2f21a0b7}documentId']
                      },
                      fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{42dfb404-4221-4f95-ba73-314e2f21a0b7}documentId']
                    ),
                    required: true,
                    validations: if(
                      or(
                        tointeger(
                          fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{5312c731-e8d4-4eed-87e1-0447536d6e4d}leadDocumentLookupRefId']
                        ) = cons!PRO_LEAD_DOCUMENT_TYPE_W9_FORM,
                        tointeger(
                          fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{5312c731-e8d4-4eed-87e1-0447536d6e4d}leadDocumentLookupRefId']
                        ) = cons!PRO_LEAD_DOCUMENT_TYPE_CONTRACT
                      ),
                      {
                        if(
                          contains("pdf", fv!files.extension),
                          "",
                          "Invalid Format"
                        )
                      },
                      if(
                        or(
                          contains("pdf", fv!files.extension),
                          contains("csv", fv!files.extension),
                          contains("xlsx", fv!files.extension)
                        ),
                        "",
                        "Invalid Format"
                      )
                    ),
                    uploadMethods: "CHOOSE_FILE",
                    buttonDisplay: "LABEL_AND_ICON",
                    buttonStyle: "STANDARD"
                  ),
                  a!textField(
                    label: "Description",
                    value: if(
                      a!isNullOrEmpty(fv!item),
                      "",
                      fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{897b83c7-cce0-4792-bd3f-ecdee384ad72}description']
                    ),
                    saveInto: fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{897b83c7-cce0-4792-bd3f-ecdee384ad72}description']
                  ),
                  a!richTextDisplayField(
                    value: a!richTextIcon(
                      icon: "times-circle-o",
                      altText: "delete",
                      caption: "Remove",
                      link: a!dynamicLink(
                        value: fv!item,
                        saveInto: {
                          a!save(
                            ri!deletedDocuments,
                            append(
                              ri!deletedDocuments,
                              todocument(
                                fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{42dfb404-4221-4f95-ba73-314e2f21a0b7}documentId']
                              )
                            )
                          ),
                          if(
                            contains(local!data, fv!item),
                            a!save(
                              ri!deletedDocumentIds,
                              append(
                                ri!deletedDocumentIds,
                                fv!item['recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents.fields.{30b4e4c0-70b2-4a92-9731-e37a96666060}leadDocumentId']
                              )
                            ),
                            {}
                          ),
                          a!save(
                            local!selectedDocuments,
                            remove(local!selectedDocuments, fv!index)
                          )
                        }
                      ),
                      linkStyle: "STANDALONE",
                      color: "NEGATIVE"
                    ),
                    align: "CENTER"
                  )
                }
              )
            )
          },
          selectionSaveInto: {},
          addRowlink: a!dynamicLink(
            label: "Add Document",
            saveInto: {
              a!save(
                local!selectedDocuments,
                append(
                  local!selectedDocuments,
                  'recordType!{e5935b72-2349-43df-bd15-908d316468be}PRO Lead Documents'()
                )
              )
            }
          ),
          validations: {},
          shadeAlternateRows: true,
          spacing: "DENSE"
        )

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data