Skip to main content
October 15, 2024
Question

RE: Update Status

  • October 15, 2024
  • 6 replies
  • 0 views

Hi,

My Requirement is to update selected checkbox(Multiple selection checkbox) row data and status by selecting dropdown to the table.

Firstly I am querying data from the table and By multiple selection trying to update the data to the table via Status.

Steps:

1.I have multiple checkbox selection .

2. Once Checkbox selected ,which ever is selected as checkbox using Dropdown trying to update to the same table.

But Attached code is not working ,if Someone Suggests for solution that would be more helpful.

 

a!localVariables(
  local!crAppDynamicChecklist_cdt: rule!CR_APP_QE_getDynamicChecklistByFilters(
    cif_int: ri!cif_int,
    sectionType_txt: cons!CR_APP_DYNAMIC_CHECKLIST_SECTION_TYPES[1]
  ),
  {
    a!gridField(
      data: local!crAppDynamicChecklist_cdt,
      columns: {
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[1],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[1],
          value: joinarray(
            remove(
              split(
                touniformstring(index(fv!row, "uniqueId_txt", {})),
                "."
              ),
              1
            ),
            "."
          )
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[2],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[2],
          value: "Collateral Documents"
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[3],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[3],
          value: fv!row.executedBy_txt
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[4],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[4],
          value: fv!row.docUniqueId_txt
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[5],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[5],
          value: fv!row.description_txt
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[6],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[6],
          value: fv!row.expiryDate_dt
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[7],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[7],
          value: fv!row.deferralDate
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[8],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[8],
          value: fv!row.complaintFlag_txt
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[9],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[9],
          value: fv!row.status_txt
        ),
        a!gridColumn(
          label: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[10],
          sortField: cons!CR_APP_TXT_ACTIVE_COMPLETED_DOCUMENTS_LABELS[10],
          value: fv!row.alertSince_dt
        )
      },
      pageSize: 10,
      selectable: true,
      selectionValue: ri!selected_int,
      selectionSaveInto: {
        ri!selected_int,
        a!save(
          ri!crAppDynamicChecklist_cdt.id_int,
          a!forEach(
            items: ri!selected_int,
            expression: index(
              index(
                local!crAppDynamicChecklist_cdt,
                fv!item,
                {}
              ),
              "id_int",
              {}
            )
          )
        )
      }
    ),
    a!columnsLayout(
      columns: {
        a!columnLayout(
          contents: {
            a!dropdownField(
              label: "Update Document Status",
              placeholder: "Please select values",
              choiceLabels: {
                "CCAD Preparation",
                "CCAD Verified",
                "Business Review",
                "Business Execution",
                " CSG Review",
                "Customer Queue"
              },
              choiceValues: {
                "CCAD Preparation",
                "CCAD Verified",
                "Business Review",
                "Business Execution",
                " CSG Review",
                "Customer Queue"
              },
              value: ri!crAppDynamicChecklist_cdt.status_txt,
              saveInto: ri!crAppDynamicChecklist_cdt.status_txt
            )
          }
        )
      },
      marginAbove: "STANDARD"
    ),
    a!buttonLayout(
      secondaryButtons: {
        a!buttonWidget(
          label: cons!APN_TXT_CANCEL,
          value: cons!APN_TXT_CANCEL,
          style: cons!APN_TXT_CANCEL_BUTTON_STYLE,
          confirmButtonLabel: cons!APN_TXT_CONFIRM,
          cancelButtonLabel: cons!APN_TXT_CANCEL,
          confirmMessage: " Do you really want to close ?",
          submit: true(),
          validate: false(),
          saveInto: ri!buttonAction_txt
        )
      },
      primaryButtons: {
        a!buttonWidget(
          label: cons!APN_TXT_SUBMIT,
          value: cons!APN_TXT_SUBMIT,
          style: cons!APN_TXT_CANCEL_BUTTON_STYLE,
          confirmButtonLabel: cons!APN_TXT_CONFIRM,
          cancelButtonLabel: cons!APN_TXT_SUBMIT,
          confirmMessage: " Do you really want to submit ?",
          submit: true(),
          validate: false(),
          saveInto: {
            ri!buttonAction_txt,
            a!save(
              ri!crAppDynamicChecklist_cdt,
              a!forEach(
                items: ri!crAppDynamicChecklist_cdt,
                expression: rule!NBF_COMMON_updateDictionary(
                  dictionary: fv!item,
                  fieldsAndValues: {
                    status_txt: fv!item.status_txt,
                    updatedOn_dt: now(),
                    updatedBy_txt: loggedInUser()
                  }
                )
              )
            )
          }
        )
      }
    )
  }
)

Thanks.

    6 replies

    somasundaram.d
    October 15, 2024

    You can construct it in the button's save into instead of selection saveinto

    October 15, 2024

    Sorry Didn't get , could you please elaborate/Code Snippet?

    somasundaram.d
    October 16, 2024

    Instead of using foreach in the selection saveInto, try to construct crAppDynamicChecklist_cdt using the list of selectedIds, in the Submit button's save into.