Getting" Could not cast from Time to Date" Error

Hi,

form is not getting opened and displays the below error:

Error Evaluating UI Expression
Expression evaluation error [evaluation ID = 74a54:998fd] in rule 'fpl_frm_etmf_upload_doc_readonly' at function a!forEach [line 427]: Error in a!forEach() expression during iteration 3: Expression evaluation error at function rule!DMD_UT_FormatDate [line 443]: Could not cast from Time to Date. Details: CastInvalidCould not cast from Time to Date. Details: CastInvalid

The  rule!DMD_UT_FormatDate is having the formation as 

if(isnull(ri!dtDate),ri!dtDate,text(ri!dtDate,"dd-mmm-yyyy"))

The parameter dtDate is a date field.

Could someone tell me why user is getting this error.

Thanks

Faisal

  Discussion posts and replies are publicly visible

Parents
  • The value you are passing in dtDate parameter of rule DMD_UT_FormatDate is of type "Time" and it expects a "Date", that's why it is giving CastInvalid. 

    Can you show the snippet of code where you are calling this rule?

  • /*
    Testing Data:
    Env:Dev:
    protocolNumber: TAK-390MR(OD)105
    projectCode: TUA92818
    documentClass: Core
    diaKey: 10.02.01
    docArtifact: 01 CRF Completion Requirements (Paper and EDC)
    unblinded: true (not required)
    for e
    docZone: 10 Data Management
    docSection: 01 Data Management Oversight
    docArtifact: ??
    
    
    
    
    */
    a!localVariables(
      local!taskDetails: rule!RM_QE_GetGDMPMRMTask(GDMPM_RM_TASK_ID: ri!taskID),
      local!labelPosition: index(cons!DMD_TXT_LST_LABEL_POSITIONS, 2, {}),
      local!etmfValueHelper: {
        if(
          rule!APN_isEmpty(
            index(
              local!taskDetails,
              "FPL_ETMF_ValueHelper",
              {}
            )
          ),
          null,
          a!fromJson(
            index(
              local!taskDetails,
              "FPL_ETMF_ValueHelper",
              "[]"
            )
          )
        )
      },
      local!esignEtmfValueHelper: {
        if(
          rule!APN_isEmpty(
            index(
              local!taskDetails,
              "FPL_ESIGN_ETMF_ValueHelper",
              {}
            )
          ),
          null,
          a!fromJson(
            index(
              local!taskDetails,
              "FPL_ESIGN_ETMF_ValueHelper",
              "[]"
            )
          )
        )
      },
      local!fromjason: if(
        rule!APN_isEmpty(
          rule!GDMPM_SO_RejectNullValuesInArray(local!etmfValueHelper)
        ),
        null,
        rule!GDMPM_SO_RejectNullValuesInArray(local!etmfValueHelper)
      ),
      local!fromJsonEsign: if(
        rule!APN_isEmpty(
          rule!GDMPM_SO_RejectNullValuesInArray(local!esignEtmfValueHelper)
        ),
        null,
        rule!GDMPM_SO_RejectNullValuesInArray(local!esignEtmfValueHelper)
      ),
      local!InitiatorComments,
      local!updatedProtocolNumber:   property(
        property(
          rule!GDMPM_SO_DMD_QE_VW_FPL_CustProj_DMD_CustProj_ByAny(
            DMD_CustProj_Id:ri!dmdCustProjectId ,
    
            isSelection: true
          ),
          "data",
          {}
        ),
        "CustProj_ProtocolIdentifier",
        {}),
      a!sectionLayout(
        label: "Upload Document to eTMF" & "|" & "Task ID:" & ri!taskID,
        contents: {
          /*if(ri!isErrorOccured,*/
          a!richTextDisplayField(
            value: a!richTextItem(
              text: concat(
                "Upload failed. Verify metadata or direct back to requester. ",
                /*changes for 5.2 sprint 2 Jira GDMPM-6656 Dev:-q1030613*/
                joinarray(
                  split(
                    if(
                      and(
                        rule!APN_isBlank(ri!uploadResponse),
                        rule!APN_isBlank(ri!etmfErrorMessage)
                      ),
                      {},
                      {
                        char(10),
                        "Error: ",
                        rule!RM_getErrorMessageFromError(
                          txtErrorMessage: index(
                            index(ri!uploadResponse, "return", {}),
                            "message",
                            {}
                          ),
                          etmfErrorMessage: ri!etmfErrorMessage
                        )/*changes end for 5.2 sprint 2 Jira GDMPM-6656 Dev:-q1030613*/
                        
                      }
                    ),
                    ";"
                  ),
                  ""
                )
              ),
              style: "STRONG",
              color: "#F00"
            ),
            showWhen: if(
              rule!APN_isBlank(ri!isErrorOccured),
              false(),
              not(ri!isErrorOccured)
            )
          ),
          a!boxLayout(
            label: "Protocol Information",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Sponsor Name",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: ri!Sponsor,
                        saveInto: ri!Sponsor,
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Project Code",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: ri!ProjectCode,
                        saveInto: ri!ProjectCode,
                        readOnly: true()
                      )
                    }
                  ),
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Protocol  Number",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: local!updatedProtocolNumber,
                        saveInto: ri!ProtocolNumber,
                        readOnly: true()
                      ),
                      a!textField(
                        label: "IQVIA eTMF Protocol  Number",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: ri!eTMFProtocolNumber,
                        saveInto: ri!eTMFProtocolNumber,
                        readOnly: true()
                      ),
                      a!textField(
                        label: "eTMF Platform",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: ri!EtmfPlatform,
                        saveInto: ri!EtmfPlatform,
                        readOnly: true()
                      )
                    }
                  )
                }
              )
            },
            shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
            padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
            style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
            isCollapsible: true,
            isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
            marginBelow: "STANDARD"
          ),
          a!boxLayout(
            label: "Document Information",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!fileUploadField(
                        label: "Document File Name",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        maxSelections: 1,
                        value: ri!Document,
                        saveInto: ri!Document,
                        disabled: true
                      ),
                      a!linkField(
                        label: "Document",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        links: a!documentDownloadLink(label: "Download", document: ri!Document)
                      ),
                      a!textField(
                        label: "Requester",
                        value: rule!DHD_UT_getUserFirstLastNameAndQid(
                          UserId: index(
                            rule!RM_QE_GetGDMPMRMTask(GDMPM_RM_TASK_ID: ri!taskID),
                            "requestor",
                            {}
                          )
                        ),
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        readOnly: true()
                      ),
                      /*5.2 release GDMPM 5886 changes*/
                      a!textField(
                        label: "Date of Upload",
                        value: rule!DMD_UT_FormatDate(
                          dtDate: index(ri!selectedTask, "LAST_UPDATED_ON", null)
                        ),
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        readOnly: true
                      )
                    },
                    showWhen: not(or(ri!isMerged))
                  ),
                  a!columnLayout(
                    contents: if(
                      not(rule!APN_isBlank(ri!EsignDocument)),
                      {
                        a!fileUploadField(
                          label: "eSignature Document",
                          labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                          maxSelections: 1,
                          value: ri!EsignDocument,
                          disabled: true
                        ),
                        a!linkField(
                          labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                          links: a!documentDownloadLink(
                            label: "Download",
                            document: ri!EsignDocument
                          )
                        )
                      },
                      {}
                    ),
                    showWhen: not(or(ri!isMerged))
                  ),
                  a!columnLayout(
                    contents: {
                      a!fileUploadField(
                        label: "Document File Name",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        maxSelections: 1,
                        value: ri!mergedDocument,
                        saveInto: ri!mergedDocument,
                        disabled: true
                      ),
                      a!linkField(
                        label: "Document",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        links: a!documentDownloadLink(label: "Download", document: ri!mergedDocument)
                      ),
                      a!textField(
                        label: "Requester",
                        value: rule!DHD_UT_getUserFirstLastNameAndQid(
                          UserId: index(
                            rule!RM_QE_GetGDMPMRMTask(GDMPM_RM_TASK_ID: ri!taskID),
                            "requestor",
                            {}
                          )
                        ),
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        readOnly: true()
                      ),
                      /*5.2 release GDMPM 5886 changes*/
                      a!textField(
                        label: "Date of Upload",
                        value: rule!DMD_UT_FormatDate(
                          dtDate: index(ri!selectedTask, "LAST_UPDATED_ON", null)
                        ),
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        readOnly: true
                      )
                    },
                    showWhen: or(ri!isMerged)
                  )
                }
              )
            },
            shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
            padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
            style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
            isCollapsible: true,
            isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
            marginBelow: "STANDARD"
          ),
          a!boxLayout(
            label: if(
              not(rule!APN_isBlank(ri!EsignDocument)),
              "Original Document Metadata",
              "Document Metadata"
            ),
            contents: a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Document Class",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "document_class", {}),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Document Zone",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_zone", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "DIA Key",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "dia_key", {}),
                      readOnly: true(),
                      /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                      showWhen: if(
                        or(
                          ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!selectedTask.ETMF_TYPE = "Wingspan"
                        ),
                        false,
                        true
                      )
                    ),
                    a!textField(
                      label: "Doc Type ID",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_type_id", {}),
                      readOnly: true(),
                      /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                      showWhen: if(
                        or(
                          ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!selectedTask.ETMF_TYPE = "Wingspan"
                        ),
                        true,
                        false
                      )
                    ),
                    a!textField(
                      label: "Document Section",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_section", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Artifact Name",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_artifact", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Major Version Number",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(
                        local!taskDetails,
                        "Major_version_number",
                        {}
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Minor Version Number",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(
                        local!taskDetails,
                        "Minor_version_number",
                        {}
                      ),
                      readOnly: true()
                    ),
                    a!paragraphField(
                      label: "Additional Information",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "Org_Comments", {}),
                      readOnly: true()
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    if(
                      rule!APN_isEmpty(local!fromjason),
                      {},
                      a!forEach(
                        items: enumerate(length(local!fromjason)) + 1,
                        expression: a!textField(
                          label: index(local!fromjason[fv!index], "label", ""),
                          value: if(
                            index(local!fromjason[fv!index], "label", "") = "Document Date",
                            rule!DMD_UT_FormatDate(
                              dtDate: index(local!fromjason[fv!index], "value", "")
                            ),
                            if(
                              index(local!fromjason[fv!index], "label", "") = "Document Owner",
                              rule!DHD_UT_getUserFirstLastNameAndQid(
                                UserId: index(local!fromjason[fv!index], "value", "")
                              ),
                              if(
                                index(local!fromjason[fv!index], "label", "") = "Receipt Date",
                                rule!DMD_UT_FormatDate(
                                  dtDate: index(local!fromjason[fv!index], "value", "")
                                ),
                                index(local!fromjason[fv!index], "value", "")
                              )
                            )
                          ),
                          labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                          readonly: true()
                        )
                      )
                    )
                  }
                )
              }
            ),
            shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
            padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
            style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
            isCollapsible: true,
            isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
            marginBelow: "STANDARD",
            showWhen: not(or(ri!isMerged))
          ),
          if(
            not(rule!APN_isBlank(ri!EsignDocument)),
            a!boxLayout(
              label: "eSignature Document Metadata",
              contents: a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Document Class",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "document_class", {}),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Document Zone",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "doc_zone", {}),
                        showWhen: if(
                          or(
                            ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!EtmfPlatform = "Wingspan"
                          ),
                          false,
                          true
                        ),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "DIA Key",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "dia_key", {}),
                        readOnly: true(),
                        /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                        showWhen: if(
                          or(
                            ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!selectedTask.ETMF_TYPE = "Wingspan"
                          ),
                          false,
                          true
                        )
                      ),
                      a!textField(
                        label: "Doc Type ID",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "doc_type_id", {}),
                        readOnly: true(),
                        /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                        showWhen: if(
                          or(
                            ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!selectedTask.ETMF_TYPE = "Wingspan"
                          ),
                          true,
                          false
                        )
                      ),
                      a!textField(
                        label: "Document Section",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "doc_section", {}),
                        showWhen: if(
                          or(
                            ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!EtmfPlatform = "Wingspan"
                          ),
                          false,
                          true
                        ),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Artifact Name",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "doc_artifact", {}),
                        showWhen: if(
                          or(
                            ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!EtmfPlatform = "Wingspan"
                          ),
                          false,
                          true
                        ),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Major Version Number",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(
                          local!taskDetails,
                          "Major_version_number",
                          {}
                        ),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Minor Version Number",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(
                          local!taskDetails,
                          "Minor_version_number",
                          {}
                        ),
                        readOnly: true()
                      ),
                      a!paragraphField(
                        label: "Additional Information",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "eSign_Comments", {}),
                        readOnly: true()
                      )
                    }
                  ),
                  a!columnLayout(
                    contents: {
                      if(
                        rule!APN_isEmpty(local!fromJsonEsign),
                        /*local!fromjason),*/
                        {},
                        a!forEach(
                          items: enumerate(
                            length(
                              /*local!fromjason*/local!fromJsonEsign
                            )
                          ) + 1,
                          expression: a!textField(
                            label: index(
                              /*local!fromjason*/local!fromJsonEsign[fv!index],
                              "label",
                              ""
                            ),
                            value: if(
                              index(
                                /*local!fromjason*/local!fromJsonEsign[fv!index],
                                "label",
                                ""
                              ) = "Document Date",
                              rule!DMD_UT_FormatDate(
                                dtDate: index(
                                  /*local!fromjason*/local!fromJsonEsign[fv!index],
                                  "value",
                                  ""
                                )
                              ),
                              if(
                                index(
                                  /*local!fromjason*/local!fromJsonEsign[fv!index],
                                  "label",
                                  ""
                                ) = "Document Owner",
                                rule!DHD_UT_getUserFirstLastNameAndQid(
                                  UserId: index(
                                    /*local!fromjason*/local!fromJsonEsign[fv!index],
                                    "value",
                                    ""
                                  )
                                ),
                                if(
                                  index(
                                    /*local!fromjason*/local!fromJsonEsign[fv!index],
                                    "label",
                                    ""
                                  ) = "Receipt Date",
                                  rule!DMD_UT_FormatDate(
                                    dtDate: index(
                                      /*local!fromjason*/local!fromJsonEsign[fv!index],
                                      "value",
                                      ""
                                    )
                                  ),
                                  index(
                                    /*local!fromjason*/local!fromJsonEsign[fv!index],
                                    "value",
                                    ""
                                  )
                                )
                              )
                            ),
                            labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                            readonly: true()
                          )
                        )
                      )
                    }
                  )
                }
              ),
              shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
              padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
              style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
              isCollapsible: true,
              isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
              marginBelow: "STANDARD",
              showWhen: not(or(ri!isMerged))
            ),
            {}
          ),
          a!boxLayout(
            label: "Document Metadata",
            contents: a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Document Class",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "document_class", {}),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Document Zone",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_zone", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "DIA Key",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "dia_key", {}),
                      readOnly: true(),
                      /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                      showWhen: if(
                        or(
                          ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!selectedTask.ETMF_TYPE = "Wingspan"
                        ),
                        false,
                        true
                      )
                    ),
                    a!textField(
                      label: "Doc Type ID",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_type_id", {}),
                      readOnly: true(),
                      /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                      showWhen: if(
                        or(
                          ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!selectedTask.ETMF_TYPE = "Wingspan"
                        ),
                        true,
                        false
                      )
                    ),
                    a!textField(
                      label: "Document Section",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_section", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Artifact Name",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_artifact", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Major Version Number",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(
                        local!taskDetails,
                        "Major_version_number",
                        {}
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Minor Version Number",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(
                        local!taskDetails,
                        "Minor_version_number",
                        {}
                      ),
                      readOnly: true()
                    ),
                    a!paragraphField(
                      label: "Additional Information",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "Org_Comments", {}),
                      readOnly: true()
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    if(
                      rule!APN_isEmpty(local!fromjason),
                      {},
                      a!forEach(
                        items: enumerate(length(local!fromjason)) + 1,
                        expression: a!textField(
                          label: index(local!fromjason[fv!index], "label", ""),
                          value: if(
                            index(local!fromjason[fv!index], "label", "") = "Document Date",
                            rule!DMD_UT_FormatDate(
                              dtDate: index(local!fromjason[fv!index], "value", "")
                            ),
                            if(
                              index(local!fromjason[fv!index], "label", "") = "Document Owner",
                              rule!DHD_UT_getUserFirstLastNameAndQid(
                                UserId: index(local!fromjason[fv!index], "value", "")
                              ),
                              if(
                                index(local!fromjason[fv!index], "label", "") = "Receipt Date",
                                rule!DMD_UT_FormatDate(
                                  dtDate: index(local!fromjason[fv!index], "value", "")
                                ),
                                index(local!fromjason[fv!index], "value", "")
                              )
                            )
                          ),
                          labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                          readonly: true()
                        )
                      )
                    )
                  }
                )
              }
            ),
            shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
            padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
            style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
            isCollapsible: true,
            isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
            marginBelow: "STANDARD",
            showWhen: or(ri!isMerged)
          ),
          rule!GDMPM_RM_TASK_COMMENTS(
            GDMPM_Task_Form: ri!GDMPM_Task_Form,
            approve: ri!approve,
            selectedTask: ri!selectedTask,
            comments: ri!InitiatorComments,
            rmqcReasonForRejection: ri!rmqcReasonForRejection,
            rmqcReasonForRejectionIds: ri!rmqcReasonForRejectionIds
          ),
          a!buttonLayout(
            primaryButtons: {
              a!buttonWidget(
                label: "Send to ETMF",
                saveInto: {a!save(ri!ProtocolNumber,local!updatedProtocolNumber)},
                submit: true,
                style: cons!GDMPM_SO_DMD_GEN_SUBMIT_BTN_STYL,
                icon: "paper-plane",
                disabled: if(
                  rule!APN_isBlank(ri!approve),
                  true,
                  if(ri!approve, false, true)
                ),
                loadingIndicator: cons!GDMPM_SO_DMD_GEN_SUBMIT_LD_INDIC,
                confirmHeader: "Confirmation",
                confirmMessage: "By clicking OK, all changes will be submitted. Are you sure you want to submit?",
                confirmButtonLabel: "OK",
                cancelButtonLabel: "CANCEL"
              )
            },
            secondaryButtons: {
              a!buttonWidget(
                label: "SEND BACK TO REQUESTER",
                submit: true,
                value: true,
                icon: "backward",
                style: cons!GDMPM_SO_DMD_GEN_CANCEL_BTN_STYL,
                saveInto: { ri!IsCancel, 
                /*to save the latest protocol number*/
                a!save(ri!ProtocolNumber,local!updatedProtocolNumber)},
                disabled: if(
                  rule!APN_isBlank(ri!approve),
                  true,
                  if(ri!approve, true, false)
                )
              )
            }
          )
        }
      )
    )

Reply
  • /*
    Testing Data:
    Env:Dev:
    protocolNumber: TAK-390MR(OD)105
    projectCode: TUA92818
    documentClass: Core
    diaKey: 10.02.01
    docArtifact: 01 CRF Completion Requirements (Paper and EDC)
    unblinded: true (not required)
    for e
    docZone: 10 Data Management
    docSection: 01 Data Management Oversight
    docArtifact: ??
    
    
    
    
    */
    a!localVariables(
      local!taskDetails: rule!RM_QE_GetGDMPMRMTask(GDMPM_RM_TASK_ID: ri!taskID),
      local!labelPosition: index(cons!DMD_TXT_LST_LABEL_POSITIONS, 2, {}),
      local!etmfValueHelper: {
        if(
          rule!APN_isEmpty(
            index(
              local!taskDetails,
              "FPL_ETMF_ValueHelper",
              {}
            )
          ),
          null,
          a!fromJson(
            index(
              local!taskDetails,
              "FPL_ETMF_ValueHelper",
              "[]"
            )
          )
        )
      },
      local!esignEtmfValueHelper: {
        if(
          rule!APN_isEmpty(
            index(
              local!taskDetails,
              "FPL_ESIGN_ETMF_ValueHelper",
              {}
            )
          ),
          null,
          a!fromJson(
            index(
              local!taskDetails,
              "FPL_ESIGN_ETMF_ValueHelper",
              "[]"
            )
          )
        )
      },
      local!fromjason: if(
        rule!APN_isEmpty(
          rule!GDMPM_SO_RejectNullValuesInArray(local!etmfValueHelper)
        ),
        null,
        rule!GDMPM_SO_RejectNullValuesInArray(local!etmfValueHelper)
      ),
      local!fromJsonEsign: if(
        rule!APN_isEmpty(
          rule!GDMPM_SO_RejectNullValuesInArray(local!esignEtmfValueHelper)
        ),
        null,
        rule!GDMPM_SO_RejectNullValuesInArray(local!esignEtmfValueHelper)
      ),
      local!InitiatorComments,
      local!updatedProtocolNumber:   property(
        property(
          rule!GDMPM_SO_DMD_QE_VW_FPL_CustProj_DMD_CustProj_ByAny(
            DMD_CustProj_Id:ri!dmdCustProjectId ,
    
            isSelection: true
          ),
          "data",
          {}
        ),
        "CustProj_ProtocolIdentifier",
        {}),
      a!sectionLayout(
        label: "Upload Document to eTMF" & "|" & "Task ID:" & ri!taskID,
        contents: {
          /*if(ri!isErrorOccured,*/
          a!richTextDisplayField(
            value: a!richTextItem(
              text: concat(
                "Upload failed. Verify metadata or direct back to requester. ",
                /*changes for 5.2 sprint 2 Jira GDMPM-6656 Dev:-q1030613*/
                joinarray(
                  split(
                    if(
                      and(
                        rule!APN_isBlank(ri!uploadResponse),
                        rule!APN_isBlank(ri!etmfErrorMessage)
                      ),
                      {},
                      {
                        char(10),
                        "Error: ",
                        rule!RM_getErrorMessageFromError(
                          txtErrorMessage: index(
                            index(ri!uploadResponse, "return", {}),
                            "message",
                            {}
                          ),
                          etmfErrorMessage: ri!etmfErrorMessage
                        )/*changes end for 5.2 sprint 2 Jira GDMPM-6656 Dev:-q1030613*/
                        
                      }
                    ),
                    ";"
                  ),
                  ""
                )
              ),
              style: "STRONG",
              color: "#F00"
            ),
            showWhen: if(
              rule!APN_isBlank(ri!isErrorOccured),
              false(),
              not(ri!isErrorOccured)
            )
          ),
          a!boxLayout(
            label: "Protocol Information",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Sponsor Name",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: ri!Sponsor,
                        saveInto: ri!Sponsor,
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Project Code",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: ri!ProjectCode,
                        saveInto: ri!ProjectCode,
                        readOnly: true()
                      )
                    }
                  ),
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Protocol  Number",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: local!updatedProtocolNumber,
                        saveInto: ri!ProtocolNumber,
                        readOnly: true()
                      ),
                      a!textField(
                        label: "IQVIA eTMF Protocol  Number",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: ri!eTMFProtocolNumber,
                        saveInto: ri!eTMFProtocolNumber,
                        readOnly: true()
                      ),
                      a!textField(
                        label: "eTMF Platform",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: ri!EtmfPlatform,
                        saveInto: ri!EtmfPlatform,
                        readOnly: true()
                      )
                    }
                  )
                }
              )
            },
            shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
            padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
            style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
            isCollapsible: true,
            isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
            marginBelow: "STANDARD"
          ),
          a!boxLayout(
            label: "Document Information",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!fileUploadField(
                        label: "Document File Name",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        maxSelections: 1,
                        value: ri!Document,
                        saveInto: ri!Document,
                        disabled: true
                      ),
                      a!linkField(
                        label: "Document",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        links: a!documentDownloadLink(label: "Download", document: ri!Document)
                      ),
                      a!textField(
                        label: "Requester",
                        value: rule!DHD_UT_getUserFirstLastNameAndQid(
                          UserId: index(
                            rule!RM_QE_GetGDMPMRMTask(GDMPM_RM_TASK_ID: ri!taskID),
                            "requestor",
                            {}
                          )
                        ),
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        readOnly: true()
                      ),
                      /*5.2 release GDMPM 5886 changes*/
                      a!textField(
                        label: "Date of Upload",
                        value: rule!DMD_UT_FormatDate(
                          dtDate: index(ri!selectedTask, "LAST_UPDATED_ON", null)
                        ),
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        readOnly: true
                      )
                    },
                    showWhen: not(or(ri!isMerged))
                  ),
                  a!columnLayout(
                    contents: if(
                      not(rule!APN_isBlank(ri!EsignDocument)),
                      {
                        a!fileUploadField(
                          label: "eSignature Document",
                          labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                          maxSelections: 1,
                          value: ri!EsignDocument,
                          disabled: true
                        ),
                        a!linkField(
                          labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                          links: a!documentDownloadLink(
                            label: "Download",
                            document: ri!EsignDocument
                          )
                        )
                      },
                      {}
                    ),
                    showWhen: not(or(ri!isMerged))
                  ),
                  a!columnLayout(
                    contents: {
                      a!fileUploadField(
                        label: "Document File Name",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        maxSelections: 1,
                        value: ri!mergedDocument,
                        saveInto: ri!mergedDocument,
                        disabled: true
                      ),
                      a!linkField(
                        label: "Document",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        links: a!documentDownloadLink(label: "Download", document: ri!mergedDocument)
                      ),
                      a!textField(
                        label: "Requester",
                        value: rule!DHD_UT_getUserFirstLastNameAndQid(
                          UserId: index(
                            rule!RM_QE_GetGDMPMRMTask(GDMPM_RM_TASK_ID: ri!taskID),
                            "requestor",
                            {}
                          )
                        ),
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        readOnly: true()
                      ),
                      /*5.2 release GDMPM 5886 changes*/
                      a!textField(
                        label: "Date of Upload",
                        value: rule!DMD_UT_FormatDate(
                          dtDate: index(ri!selectedTask, "LAST_UPDATED_ON", null)
                        ),
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        readOnly: true
                      )
                    },
                    showWhen: or(ri!isMerged)
                  )
                }
              )
            },
            shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
            padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
            style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
            isCollapsible: true,
            isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
            marginBelow: "STANDARD"
          ),
          a!boxLayout(
            label: if(
              not(rule!APN_isBlank(ri!EsignDocument)),
              "Original Document Metadata",
              "Document Metadata"
            ),
            contents: a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Document Class",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "document_class", {}),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Document Zone",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_zone", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "DIA Key",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "dia_key", {}),
                      readOnly: true(),
                      /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                      showWhen: if(
                        or(
                          ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!selectedTask.ETMF_TYPE = "Wingspan"
                        ),
                        false,
                        true
                      )
                    ),
                    a!textField(
                      label: "Doc Type ID",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_type_id", {}),
                      readOnly: true(),
                      /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                      showWhen: if(
                        or(
                          ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!selectedTask.ETMF_TYPE = "Wingspan"
                        ),
                        true,
                        false
                      )
                    ),
                    a!textField(
                      label: "Document Section",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_section", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Artifact Name",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_artifact", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Major Version Number",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(
                        local!taskDetails,
                        "Major_version_number",
                        {}
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Minor Version Number",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(
                        local!taskDetails,
                        "Minor_version_number",
                        {}
                      ),
                      readOnly: true()
                    ),
                    a!paragraphField(
                      label: "Additional Information",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "Org_Comments", {}),
                      readOnly: true()
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    if(
                      rule!APN_isEmpty(local!fromjason),
                      {},
                      a!forEach(
                        items: enumerate(length(local!fromjason)) + 1,
                        expression: a!textField(
                          label: index(local!fromjason[fv!index], "label", ""),
                          value: if(
                            index(local!fromjason[fv!index], "label", "") = "Document Date",
                            rule!DMD_UT_FormatDate(
                              dtDate: index(local!fromjason[fv!index], "value", "")
                            ),
                            if(
                              index(local!fromjason[fv!index], "label", "") = "Document Owner",
                              rule!DHD_UT_getUserFirstLastNameAndQid(
                                UserId: index(local!fromjason[fv!index], "value", "")
                              ),
                              if(
                                index(local!fromjason[fv!index], "label", "") = "Receipt Date",
                                rule!DMD_UT_FormatDate(
                                  dtDate: index(local!fromjason[fv!index], "value", "")
                                ),
                                index(local!fromjason[fv!index], "value", "")
                              )
                            )
                          ),
                          labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                          readonly: true()
                        )
                      )
                    )
                  }
                )
              }
            ),
            shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
            padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
            style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
            isCollapsible: true,
            isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
            marginBelow: "STANDARD",
            showWhen: not(or(ri!isMerged))
          ),
          if(
            not(rule!APN_isBlank(ri!EsignDocument)),
            a!boxLayout(
              label: "eSignature Document Metadata",
              contents: a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Document Class",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "document_class", {}),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Document Zone",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "doc_zone", {}),
                        showWhen: if(
                          or(
                            ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!EtmfPlatform = "Wingspan"
                          ),
                          false,
                          true
                        ),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "DIA Key",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "dia_key", {}),
                        readOnly: true(),
                        /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                        showWhen: if(
                          or(
                            ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!selectedTask.ETMF_TYPE = "Wingspan"
                          ),
                          false,
                          true
                        )
                      ),
                      a!textField(
                        label: "Doc Type ID",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "doc_type_id", {}),
                        readOnly: true(),
                        /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                        showWhen: if(
                          or(
                            ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!selectedTask.ETMF_TYPE = "Wingspan"
                          ),
                          true,
                          false
                        )
                      ),
                      a!textField(
                        label: "Document Section",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "doc_section", {}),
                        showWhen: if(
                          or(
                            ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!EtmfPlatform = "Wingspan"
                          ),
                          false,
                          true
                        ),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Artifact Name",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "doc_artifact", {}),
                        showWhen: if(
                          or(
                            ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                            ri!EtmfPlatform = "Wingspan"
                          ),
                          false,
                          true
                        ),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Major Version Number",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(
                          local!taskDetails,
                          "Major_version_number",
                          {}
                        ),
                        readOnly: true()
                      ),
                      a!textField(
                        label: "Minor Version Number",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(
                          local!taskDetails,
                          "Minor_version_number",
                          {}
                        ),
                        readOnly: true()
                      ),
                      a!paragraphField(
                        label: "Additional Information",
                        labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                        value: index(local!taskDetails, "eSign_Comments", {}),
                        readOnly: true()
                      )
                    }
                  ),
                  a!columnLayout(
                    contents: {
                      if(
                        rule!APN_isEmpty(local!fromJsonEsign),
                        /*local!fromjason),*/
                        {},
                        a!forEach(
                          items: enumerate(
                            length(
                              /*local!fromjason*/local!fromJsonEsign
                            )
                          ) + 1,
                          expression: a!textField(
                            label: index(
                              /*local!fromjason*/local!fromJsonEsign[fv!index],
                              "label",
                              ""
                            ),
                            value: if(
                              index(
                                /*local!fromjason*/local!fromJsonEsign[fv!index],
                                "label",
                                ""
                              ) = "Document Date",
                              rule!DMD_UT_FormatDate(
                                dtDate: index(
                                  /*local!fromjason*/local!fromJsonEsign[fv!index],
                                  "value",
                                  ""
                                )
                              ),
                              if(
                                index(
                                  /*local!fromjason*/local!fromJsonEsign[fv!index],
                                  "label",
                                  ""
                                ) = "Document Owner",
                                rule!DHD_UT_getUserFirstLastNameAndQid(
                                  UserId: index(
                                    /*local!fromjason*/local!fromJsonEsign[fv!index],
                                    "value",
                                    ""
                                  )
                                ),
                                if(
                                  index(
                                    /*local!fromjason*/local!fromJsonEsign[fv!index],
                                    "label",
                                    ""
                                  ) = "Receipt Date",
                                  rule!DMD_UT_FormatDate(
                                    dtDate: index(
                                      /*local!fromjason*/local!fromJsonEsign[fv!index],
                                      "value",
                                      ""
                                    )
                                  ),
                                  index(
                                    /*local!fromjason*/local!fromJsonEsign[fv!index],
                                    "value",
                                    ""
                                  )
                                )
                              )
                            ),
                            labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                            readonly: true()
                          )
                        )
                      )
                    }
                  )
                }
              ),
              shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
              padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
              style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
              isCollapsible: true,
              isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
              marginBelow: "STANDARD",
              showWhen: not(or(ri!isMerged))
            ),
            {}
          ),
          a!boxLayout(
            label: "Document Metadata",
            contents: a!columnsLayout(
              columns: {
                a!columnLayout(
                  contents: {
                    a!textField(
                      label: "Document Class",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "document_class", {}),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Document Zone",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_zone", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "DIA Key",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "dia_key", {}),
                      readOnly: true(),
                      /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                      showWhen: if(
                        or(
                          ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!selectedTask.ETMF_TYPE = "Wingspan"
                        ),
                        false,
                        true
                      )
                    ),
                    a!textField(
                      label: "Doc Type ID",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_type_id", {}),
                      readOnly: true(),
                      /* Release 5.2/ Sprint 3 / GDMPM 7564 /displaying field conditionally */
                      showWhen: if(
                        or(
                          ri!selectedTask.ETMF_TYPE = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!selectedTask.ETMF_TYPE = "Wingspan"
                        ),
                        true,
                        false
                      )
                    ),
                    a!textField(
                      label: "Document Section",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_section", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Artifact Name",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "doc_artifact", {}),
                      showWhen: if(
                        or(
                          ri!EtmfPlatform = cons!RM_QC_ETMF_TYPE_WINGSPAN,
                          ri!EtmfPlatform = "Wingspan"
                        ),
                        false,
                        true
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Major Version Number",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(
                        local!taskDetails,
                        "Major_version_number",
                        {}
                      ),
                      readOnly: true()
                    ),
                    a!textField(
                      label: "Minor Version Number",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(
                        local!taskDetails,
                        "Minor_version_number",
                        {}
                      ),
                      readOnly: true()
                    ),
                    a!paragraphField(
                      label: "Additional Information",
                      labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                      value: index(local!taskDetails, "Org_Comments", {}),
                      readOnly: true()
                    )
                  }
                ),
                a!columnLayout(
                  contents: {
                    if(
                      rule!APN_isEmpty(local!fromjason),
                      {},
                      a!forEach(
                        items: enumerate(length(local!fromjason)) + 1,
                        expression: a!textField(
                          label: index(local!fromjason[fv!index], "label", ""),
                          value: if(
                            index(local!fromjason[fv!index], "label", "") = "Document Date",
                            rule!DMD_UT_FormatDate(
                              dtDate: index(local!fromjason[fv!index], "value", "")
                            ),
                            if(
                              index(local!fromjason[fv!index], "label", "") = "Document Owner",
                              rule!DHD_UT_getUserFirstLastNameAndQid(
                                UserId: index(local!fromjason[fv!index], "value", "")
                              ),
                              if(
                                index(local!fromjason[fv!index], "label", "") = "Receipt Date",
                                rule!DMD_UT_FormatDate(
                                  dtDate: index(local!fromjason[fv!index], "value", "")
                                ),
                                index(local!fromjason[fv!index], "value", "")
                              )
                            )
                          ),
                          labelPosition: cons!GDMPM_SO_DMD_TXT_FILTER_LABEL_POSITION,
                          readonly: true()
                        )
                      )
                    )
                  }
                )
              }
            ),
            shape: cons!GDMPM_SO_DMD_TXT_GEN_BOX_SHAPE,
            padding: cons!GDMPM_SO_DMD_TXT_GEN_BOX_PADD,
            style: cons!GDMPM_SO_DMD_TXT_GEN_BOX_STYLE,
            isCollapsible: true,
            isInitiallyCollapsed: cons!GDMPM_SO_DMD_BLN_IS_SEC_INI_CLPSD,
            marginBelow: "STANDARD",
            showWhen: or(ri!isMerged)
          ),
          rule!GDMPM_RM_TASK_COMMENTS(
            GDMPM_Task_Form: ri!GDMPM_Task_Form,
            approve: ri!approve,
            selectedTask: ri!selectedTask,
            comments: ri!InitiatorComments,
            rmqcReasonForRejection: ri!rmqcReasonForRejection,
            rmqcReasonForRejectionIds: ri!rmqcReasonForRejectionIds
          ),
          a!buttonLayout(
            primaryButtons: {
              a!buttonWidget(
                label: "Send to ETMF",
                saveInto: {a!save(ri!ProtocolNumber,local!updatedProtocolNumber)},
                submit: true,
                style: cons!GDMPM_SO_DMD_GEN_SUBMIT_BTN_STYL,
                icon: "paper-plane",
                disabled: if(
                  rule!APN_isBlank(ri!approve),
                  true,
                  if(ri!approve, false, true)
                ),
                loadingIndicator: cons!GDMPM_SO_DMD_GEN_SUBMIT_LD_INDIC,
                confirmHeader: "Confirmation",
                confirmMessage: "By clicking OK, all changes will be submitted. Are you sure you want to submit?",
                confirmButtonLabel: "OK",
                cancelButtonLabel: "CANCEL"
              )
            },
            secondaryButtons: {
              a!buttonWidget(
                label: "SEND BACK TO REQUESTER",
                submit: true,
                value: true,
                icon: "backward",
                style: cons!GDMPM_SO_DMD_GEN_CANCEL_BTN_STYL,
                saveInto: { ri!IsCancel, 
                /*to save the latest protocol number*/
                a!save(ri!ProtocolNumber,local!updatedProtocolNumber)},
                disabled: if(
                  rule!APN_isBlank(ri!approve),
                  true,
                  if(ri!approve, true, false)
                )
              )
            }
          )
        }
      )
    )

Children