Currently , I am calling integration for each row separately,But I want optimize the code, Is there any way I can call integration just once and populate different row as per doc Id

Certified Associate Developer

a!localVariables(
  local!transactionCDM: index(
    index(
      rule!NW_Transaction(ri!transactionId),
      "result",
      {}
    ),
    "body",
    {}
  ),
  local!documentDetails: index(
    local!transactionCDM,
    "supporting_documents",
    {}
  ),
  local!selectedDocument,
  {
    if(
      a!isNotNullOrEmpty(local!selectedDocument),
      {
        /*{rule!NW_verticalSpacer(n: 4),*/
        rule!NW_UpdateDocumentDetails(
          selectedDocument: local!selectedDocument,
          transactionCDM: local!transactionCDM,
          showWhen: a!isNotNullOrEmpty(local!selectedDocument),
          transactionId: ri!transactionId
        )
      },
      a!cardLayout(
        contents: {
          a!recordActionField(
            actions: a!recordActionItem(
              action: 'recordType!{fff94020-d948-4267-8934-8f9a465308bd}NW Transaction.actions.{ba411847-1b0f-4a59-a70f-72a877d724f0}uploadDocument',
              identifier: ri!transactionId
            ),
            align: "END"
          ),
          a!gridField(
            data: local!documentDetails,
            columns: {
              a!gridColumn(
                label: "Document Form Name",
                value: a!richTextDisplayField(
                  value: a!richTextItem(
                    text: a!defaultValue(
                      value: index(fv!row, "form_name", {}),
                      default: cons!NW_NULL_PLACEHOLDER_VALUE
                    ),
                    link: a!safeLink(
                      uri: index(
                        index(
                          index(
                            rule!NW_GetDocumentDetails(docId: index(fv!row, "document_id", {})),
                            "result",
                            ""
                          ),
                          "body",
                          ""
                        ),
                        "document_url",
                        {}
                      ),
                      openLinkIn: "NEW_TAB"
                    ),
                    linkStyle: "STANDALONE"
                  )
                ),
                align: "START"
              ),
              a!gridColumn(
                label: "Origination",
                value: a!richTextDisplayField(
                  value: a!richTextItem(
                    text: a!defaultValue(
                      value: index(
                        index(
                          index(
                            rule!NW_GetDocumentDetails(docId: index(fv!row, "document_id", {})),
                            "result",
                            ""
                          ),
                          "body",
                          ""
                        ),
                        "origination",
                        {}
                      ),
                      default: cons!NW_NULL_PLACEHOLDER_VALUE
                    )
                  )
                ),
                align: "START"
              ),
              a!gridColumn(
                label: "Created On",
                sortField: "created_date",
                value: a!richTextDisplayField(
                  value: a!richTextItem(
                    text: a!defaultValue(
                      value: index(fv!row, "document_date", {}),
                      default: cons!NW_NULL_PLACEHOLDER_VALUE
                    )
                  )
                ),
                align: "START"
              ),
              a!gridColumn(
                label: "External Contract Number",
                value: a!richTextDisplayField(
                  value: a!richTextItem(
                    text: a!defaultValue(
                      value: index(fv!row, "external_contract_number", {}),
                      default: cons!NW_NULL_PLACEHOLDER_VALUE
                    )
                  )
                ),
                align: "START"
              ),
              a!gridColumn(
                label: "Status",
                value: a!richTextDisplayField(
                  value: a!richTextItem(
                    text: a!defaultValue(
                      value: index(fv!row, "document_state", {}),
                      default: cons!NW_NULL_PLACEHOLDER_VALUE
                    )
                  )
                ),
                align: "START"
              ),
              a!gridColumn(
                label: "Updated On",
                sortField: "modified_date",
                value: a!richTextDisplayField(
                  value: a!richTextItem(
                    text: a!defaultValue(
                      value: todate(
                        index(
                          index(
                            index(
                              rule!NW_GetDocumentDetails(docId: index(fv!row, "document_id", {})),
                              "result",
                              ""
                            ),
                            "body",
                            ""
                          ),
                          "modified_date",
                          {}
                        )
                      ),
                      default: cons!NW_NULL_PLACEHOLDER_VALUE
                    )
                  )
                ),
                align: "START"
              ),
              a!gridColumn(
                label: "Tracking Number",
                value: a!richTextDisplayField(
                  value: a!richTextItem(
                    text: a!defaultValue(
                      value: index(
                        index(
                          index(
                            rule!NW_GetDocumentDetails(docId: index(fv!row, "document_id", {})),
                            "result",
                            ""
                          ),
                          "body",
                          ""
                        ),
                        "tracking_number",
                        {}
                      ),
                      default: cons!NW_NULL_PLACEHOLDER_VALUE
                    )
                  )
                )
              ),
              a!gridColumn(
                value: a!richTextDisplayField(
                  value: {
                    a!richTextIcon(
                      icon: "dot-circle-o",
                      caption: "Update Document",
                      link: a!dynamicLink(
                        value: fv!row,
                        saveInto: local!selectedDocument
                      ),
                      linkStyle: "STANDALONE",
                      color: "POSITIVE"
                    )
                  },
                  showWhen: a!isNotNullOrEmpty(local!documentDetails)
                )
              )
            },
            pageSize: a!defaultValue(
              ri!pageSize,
              cons!CMGT_INT_BATCH_SIZE_SMALL
            )
          )
        },
        style: "NONE",
        shape: "ROUNDED",
        padding: "STANDARD",
        showBorder: false,
        showShadow: true,
        decorativeBarPosition: "TOP",
        decorativeBarColor: cons!NW_COLOR_PRIMARY
      )
    )
  }
)

Here , this integration  "rule!NW_GetDocumentDetails(docId: index(fv!row, "document_id", {}))", is called separately for different row , but I want to optimize it, please help regarding this scenario

  Discussion posts and replies are publicly visible

Parents Reply Children
No Data