Refresh button failing when using it for second time in interface with editable grid

Certified Associate Developer

Hi!

Im having trouble with a Refresh button in an editable grid.

The data in the editable grid comes from an expression rule which queries the DB.

The thing is, when I have two tabs (lets call them A and B) in the browser with the same interface opened, when I make changes in the Tab A and then refresh the editable grid in Tab B, it works OK and the data is properly refreshed and I see the changes in both tabs. But then, if I make any other change in Tab A, and then I refresh again in Tab B, the data is no more refreshed.

To clarify things, if I reload the tab presing F5, the changes made for the 2nd time in Tab A now appears correctly in Tab B, but I want this same behaviour to occur when using the Refresh button in the interface.

Thanks!

P.D.: If u need some screenshots just let me know and Ill post them ASAP.

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Senior Developer

    Please share your code snippets, that would help.

  • 0
    Certified Associate Developer
    in reply to Konduru Chaitanya

    a!localVariables(
      local!numPagina: 0,
      local!re: 0,
      local!refresco: false,
      local!pagingInfo: a!pagingInfo(1, cons!AAC_C_BACTHSIZE),
    
      local!filtro,
      local!allRemitentes: rule!AAC_ER_getAllRemitentes(filtro: local!filtro),
      local!remitentes: a!refreshVariable(
        value: rule!AAC_ER_ObtenerRemitentesPaginados(
          pagingInfo: local!pagingInfo,
          filtro: local!filtro,
          refresco: local!refresco, 
        ),
        refreshAlways: true,
        refreshOnVarChange: { local!numPagina, local!refresco },
        refreshOnReferencedVarChange: false
      ),
      local!remitentesMod: local!remitentes,
      local!datosPagina: todatasubset(local!remitentesMod).data,
      local!remitentesBorrar: {},
      local!desactivarConfirmar: true,
      local!remitentesModBPM,
      local!exportDocId,
      local!mensajeError,
      a!headerContentLayout(
        header: {
          a!billboardLayout(
            backgroundMedia: a!documentImage(document: cons!AAC_C_IMAGEN_CABECERA),
            backgroundColor: "#f0f0f0",
            height: "SHORT_PLUS",
            marginBelow: "NONE",
            overlay: a!barOverlay(
              contents: {
                a!richTextDisplayField(
                  label: "Texto enriquecido",
                  labelPosition: "COLLAPSED",
                  value: {
                    a!richTextItem(
                      text: {
                        "Actualización Automática de Callsigns en Scena"
                      },
                      color: cons!AAC_C_COLOR_VERDE_AENA,
                      style: { "STRONG" }
                    )
                  }
                )
              },
              style: "DARK",
              padding: "STANDARD"
            )
          )
        },
        contents: {
          a!sectionLayout(
            contents: {
              a!sideBySideLayout(
                items: {
                  a!sideBySideItem(
                    item: a!textField(
                      placeholder: "Filtrar por correo o compañía...",
                      value: local!filtro,
                      saveInto: {
                        local!filtro,
                        a!save(local!numpagina, 0),
                        a!save(
                          local!pagingInfo,
                          a!pagingInfo(1, cons!AAC_C_BACTHSIZE)
                        ),
                        a!save(local!exportDocId, null)
                      },
                      refreshAfter: "UNFOCUS",
                      characterLimit: 50,
                      showCharacterCount: false
                    )
                  ),
                  a!sideBySideItem(
                    item: a!buttonArrayLayout(
                      buttons: a!buttonWidget(
                        label: "Exportar",
                        saveInto: a!exportDataStoreEntityToExcel(
                          entity: cons!AAC_C_ENTIDAD_REMITENTE,
                          filters: if(
                            a!isNotNullOrEmpty(local!filtro),
                            a!queryLogicalExpression(
                              operator: "OR",
                              filters: {
                                a!queryFilter(
                                  field: "email",
                                  operator: "includes",
                                  value: local!filtro
                                ),
                                a!queryFilter(
                                  field: "descripcion",
                                  operator: "includes",
                                  value: local!filtro
                                ),
                                a!queryFilter(
                                  field: "iata",
                                  operator: "includes",
                                  value: local!filtro
                                ),
                                a!queryFilter(
                                  field: "oaci",
                                  operator: "includes",
                                  value: local!filtro
                                )
                              },
                              ignoreFiltersWithEmptyValues: true
                            ),
                            null
                          ),
                          documentName: "Remitentes_" & now(),
                          saveInFolder: cons!AAC_C_EXPORTACIONES,
                          onSuccess: a!save(local!exportDocId, fv!newDocument),
                          onError: a!save(
                            local!mensajeError,
                            "Error al generar el fichero"
                          )
                        ),
                        style: "GHOST",
                        color: "#008000",
                        loadingIndicator: true,
                        showWhen: a!isNotNullOrEmpty(local!remitentes)
                      ),
                      align: "START"
                    )
                  )
                },
                marginBelow: "NONE"
              ),
              a!textField(
                label: "Contador refresco",
                labelPosition: "ABOVE",
                value: local!re,
                saveInto: local!re,
                refreshAfter: "UNFOCUS",
                validations: {}
              ),
              a!richTextDisplayField(
                value: {
                  a!richTextItem(
                    text: {
                      a!richTextIcon(icon: "download"),
                      "Descargar remitentes"
                    },
                    link: a!documentDownloadLink(document: local!exportDocId),
                    linkStyle: "STANDALONE"
                  )
                },
                showWhen: a!isNotNullOrEmpty(local!exportDocId)
              ),
              a!gridLayout(
                /*totalCount: count(local!remitentesMod),*/
                headerCells: {
                  a!gridLayoutHeaderCell(label: "Correo electrónico"),
                  a!gridLayoutHeaderCell(label: "IATA"),
                  a!gridLayoutHeaderCell(label: "OACI"),
                  a!gridLayoutHeaderCell(label: "Descripción"),
                  a!gridLayoutHeaderCell(label: "Usuario de alta"),
                  a!gridLayoutHeaderCell(label: "Fecha de alta"),
                  a!gridLayoutHeaderCell(label: "Usuario de modificación"),
                  a!gridLayoutHeaderCell(label: "Fecha de modificación"),
                  a!gridLayoutHeaderCell(label: "")
                },
                columnConfigs: {
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "ICON")
                },
                rows: a!forEach(
                  items: local!datosPagina,
                  expression: a!gridRowLayout(
                    id: fv!index,
                    contents: {
                      /* Correo electrónico */
                      a!textField(
                        value: trim(
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email']
                        ),
                        saveInto: {
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email'],
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              loggedInUser(),
                              null
                            )
                          ),
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              now(),
                              null
                            )
                          ),
                          a!save(local!desactivarConfirmar, false)
                        },
                        refreshAfter: "UNFOCUS",
                        characterLimit: 100,
                        showCharacterCount: false,
                        required: true,
                        requiredMessage: "Campo obligatorio",
                        validations: {
                          if(
                            a!isNotNullOrEmpty(
                              rule!AAC_EC_ObtenerRemitentePorEmailNoID(
                                email: fv!item['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email'],
                                ID: fv!item['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              )
                            ),
                            "Ya existe este correo electrónico",
                            ""
                          ),
                          if(
                            validateemailaddress(
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email']
                            ) = false,
                            "Formato email inválido",
                            ""
                          ),
                          if(
                            a!isNullOrEmpty(
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email']
                            ),
                            "No puede dejar el campo vacío",
                            ""
                          )
                        },
                        validationGroup: "Remitente"
                      ),
                      /*IATA*/
                      a!textField(
                        value: local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dd131812-ae89-4a6d-80fe-571ed9fe0cdc}iata'],
                        saveInto: {
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dd131812-ae89-4a6d-80fe-571ed9fe0cdc}iata'],
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              loggedInUser(),
                              null
                            )
                          ),
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              now(),
                              null
                            )
                          ),
                          a!save(local!desactivarConfirmar, false)
                        },
                        refreshAfter: "UNFOCUS",
                        characterLimit: 3,
                        showCharacterCount: false,
                        required: true,
                        requiredMessage: "Especificar IATA",
                        validations: {
                          if(
                            regexmatch(
                              "^[A-Z]{3}",
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dd131812-ae89-4a6d-80fe-571ed9fe0cdc}iata']
                            ) = false,
                            "Introduzca un código IATA válido",
                            {}
                          ),
                          if(
                            a!isNullOrEmpty(
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dd131812-ae89-4a6d-80fe-571ed9fe0cdc}iata']
                            ),
                            "No puede dejar el campo vacío",
                            ""
                          )
                        }
                      ),
                      /*OACI*/
                      a!textField(
                        value: local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e95df776-1b43-4f70-ad7b-6b66c44930ea}oaci'],
                        saveInto: {
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e95df776-1b43-4f70-ad7b-6b66c44930ea}oaci'],
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              loggedInUser(),
                              null
                            )
                          ),
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              now(),
                              null
                            )
                          ),
                          a!save(local!desactivarConfirmar, false)
                        },
                        refreshAfter: "UNFOCUS",
                        characterLimit: 4,
                        showCharacterCount: false,
                        required: true,
                        requiredMessage: "Especificar OACI",
                        validations: {
                          if(
                            regexmatch(
                              "^[A-Z]{3}",
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e95df776-1b43-4f70-ad7b-6b66c44930ea}oaci']
                            ) = false,
                            "Introduzca un código IATA válido",
                            {}
                          ),
                          if(
                            a!isNullOrEmpty(
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e95df776-1b43-4f70-ad7b-6b66c44930ea}oaci']
                            ),
                            "No puede dejar el campo vacío",
                            ""
                          )
                        }
                      ),
                      /* Compañia */
                      a!textField(
                        value: trim(
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ed5d29e9-0e3c-42bd-9676-08f94c230261}descripcion']
                        ),
                        saveInto: {
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ed5d29e9-0e3c-42bd-9676-08f94c230261}descripcion'],
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              loggedInUser(),
                              null
                            )
                          ),
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              now(),
                              null
                            )
                          ),
                          a!save(local!desactivarConfirmar, false)
                        },
                        refreshAfter: "UNFOCUS",
                        characterLimit: 255,
                        showCharacterCount: false,
                        required: true,
                        requiredMessage: "Campo obligatorio",
                        validations: if(
                          a!isNullOrEmpty(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ed5d29e9-0e3c-42bd-9676-08f94c230261}descripcion']
                          ),
                          "No puede dejar el campo vacío",
                          ""
                        )
                      ),
                      /* Usuario de alta */
                      a!textField(
                        value: local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ca988606-2fda-4fe0-ab98-16d14909e377}creadoPor'],
                        readOnly: true
                      ),
                      /* Fecha de alta */
                      a!textField(
                        value: text(
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e6141866-56fe-4f33-88bf-23405b40164b}creadoEn'],
                          cons!AAC_C_FORMATO_FECHAS
                        ),
                        readOnly: true
                      ),
                      /* Usuario de modificación */
                      a!textField(
                        value: local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                        readOnly: true
                      ),
                      /* Fecha de modificación */
                      a!textField(
                        value: if(
                          a!isNotNullOrEmpty(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn']
                          ),
                          text(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            cons!AAC_C_FORMATO_FECHAS
                          ),
                          null
                        ),
                        readOnly: true
                      ),
                      /* Botón para borrar. */
                      a!richTextDisplayField(
                        value: a!richTextIcon(
                          icon: "close",
                          altText: "Borrar " & fv!index,
                          caption: "Borrar " & fv!item['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email'],
                          link: a!dynamicLink(
                            value: fv!index,
                            saveInto: {
                              a!save(
                                local!remitentesBorrar,
                                append(
                                  local!remitentesBorrar,
                                  local!remitentesMod[save!value]
                                )
                              ),
                              a!save(
                                local!remitentesMod,
                                remove(local!remitentesMod, save!value)
                              ),
                              a!save(local!desactivarConfirmar, false)
                            }
                          ),
                          linkStyle: "STANDALONE",
                          color: "NEGATIVE"
                        )
                      )
                    }
                  )
                ),
                addRowlink: a!dynamicLink(
                  label: "Añadir remitente",
                  value: {
                    'recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido'(
                      'recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ca988606-2fda-4fe0-ab98-16d14909e377}creadoPor': loggedInUser(),
                      'recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e6141866-56fe-4f33-88bf-23405b40164b}creadoEn': now()
                    )
                  },
                  saveInto: {
                    a!save(
                      local!remitentesMod,
                      append(local!remitentesMod, save!value)
                    ),
                    a!save(local!desactivarConfirmar, false)
                  }
                ),
                rowHeader: 1
              )
            }
          ),
          a!buttonArrayLayout(
            buttons: {
              a!buttonWidget(
                label: "Refrescar",
                saveInto: {
                  a!save(local!refresco, not(local!refresco)),
                  /*a!save(*/
                    /*local!remitentes,*/
                    /*rule!AAC_ER_ObtenerRemitentesPaginados(*/
                      /*filtro: local!filtro,*/
                      /*pagingInfo: local!pagingInfo,*/
                      /*refresco: local!refresco*/
                    /*)*/
                  /*),*/
                  /*a!save(*/
                    /*local!remitentesMod,*/
                    /*rule!AAC_ER_ObtenerRemitentesPaginados(*/
                      /*filtro: local!filtro,*/
                      /*pagingInfo: local!pagingInfo,*/
                      /*refresco: local!refresco*/
                    /*)*/
                  /*),*/
                  /*a!save(*/
                    /*local!datosPagina,*/
                    /*todatasubset(*/
                      /*rule!AAC_ER_ObtenerRemitentesPaginados(*/
                        /*filtro: local!filtro,*/
                        /*pagingInfo: local!pagingInfo,*/
                        /*refresco: local!refresco*/
                      /*)*/
                    /*).data*/
                  /*),*/
                  a!save(
                    local!allRemitentes,
                    rule!AAC_ER_getAllRemitentes(filtro: local!filtro)
                  ),
                  a!save(local!remitentesBorrar, {}),
                  a!save(local!desactivarConfirmar, true),
                  a!save(local!re, local!re + 1),
                  
                },
                color: cons!AAC_C_COLOR_VERDE_AENA,
                confirmHeader: "Refrescar",
                confirmMessage: "Los cambios NO confirmados se perderán.",
                confirmButtonLabel: "Aceptar",
                cancelButtonLabel: "Cancelar"
              ),
              a!buttonWidget(
                label: "Confirmar",
                saveInto: {
                  /* Prevenimos que confirmen dos veces. */
                  a!save(local!desactivarConfirmar, true),
                  /* Remitentes a borrar. */
                  a!save(
                    local!remitentesBorrar,
                    reject(
                      fn!isnull,
                      a!forEach(
                        items: local!remitentesBorrar,
                        expression: if(
                          a!isNullOrEmpty(fv!item),
                          null,
                          if(
                            a!isNotNullOrEmpty(
                              fv!item['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                            ),
                            fv!item,
                            null
                          )
                        )
                      )
                    )
                  ),
                  /* 
                  Sólo nos quedamos con los nuevos remitentes (los que
                  tienen el campo ID vacío) o con aquellos remitentes
                  que se han modificado. Se considera que un remitente
                  se ha modificado cuando se modifica por primera vez
                  (no tenía fecha de modificación) o cuando la fecha de
                  modificación actual es mayor a la que venía de BBDD.
                */
                  /*en el proceso hay que comprobar si se cambió la compañia de vuelo en lugar del email, que en ese caso
                  para un contacto permitido ya registrado con email, no se le manda el email del alta*/
                  a!save(
                    local!remitentesModBPM,
                    difference(local!remitentesMod, local!remitentes)
                  ),
                  /*
                  Proceso que se encarga de eliminar, dar de alta y
                  modificar remitentes.
                */
                  a!startProcess(
                    processModel: cons!AAC_C_ACTUALIZAR_REMITENTES,
                    processParameters: {
                      remitentesBorrar: local!remitentesBorrar,
                      remitentesMod: local!remitentesModBPM
                    }
                  )
                },
                color: cons!AAC_C_COLOR_VERDE_AENA,
                disabled: local!desactivarConfirmar,
                validate: true,
                validationGroup: "Remitente",
                confirmHeader: "Confirmar cambios",
                confirmMessage: "Los cambios realizados se harán permanentes.",
                confirmButtonLabel: "Aceptar",
                cancelButtonLabel: "Cancelar"
              )
            },
            align: "END"
          ),
          a!richTextDisplayField(
            value: {
              a!richTextIcon(
                icon: "chevron-left",
                link: a!dynamicLink(
                  saveInto: {
                    a!save(
                      local!pagingInfo,
                      a!pagingInfo(
                        startIndex: local!pagingInfo.startIndex - local!pagingInfo.batchSize,
                        batchSize: local!pagingInfo.batchSize,
                        sort: local!pagingInfo.sort
                      )
                    ),
                    a!save(local!numPagina, local!numPagina - 1)
                  },
                  showWhen: local!pagingInfo.startIndex > 1
                ),
                linkStyle: "STANDALONE"
              ),
              a!richTextItem(
                text: {
                  char(32),
                  a!richTextItem(
                    text: {
                      joinarray(
                        {
                          property(local!pagingInfo, "startIndex"),
                          char(45),
                          if(
                            local!pagingInfo.startIndex = count(local!remitentesMod),
                            count(local!remitentesMod),
                            local!pagingInfo.batchSize * (local!numPagina + 1)
                          )
                        },
                        char(32)
                      )
                    },
                    style: "STRONG"
                  ),
                  char(32),
                  joinarray(
                    { "de", count(local!allRemitentes) },
                    char(32)
                  ),
                  char(32)
                }
              ),
              a!richTextIcon(
                icon: "chevron-right",
                link: a!dynamicLink(
                  saveInto: {
                    a!save(
                      local!pagingInfo,
                      a!pagingInfo(
                        startIndex: local!pagingInfo.startIndex + local!pagingInfo.batchSize,
                        batchSize: local!pagingInfo.batchSize,
                        sort: local!pagingInfo.sort
                      )
                    ),
                    a!save(local!numPagina, local!numPagina + 1)
                  },
                  showWhen: count(local!datospagina) = 10/*and(*/
                  /*local!pagingInfo.startIndex <= count(local!allRemitentes) - local!pagingInfo.batchSize,*/
                  /*not(*/
                  /*local!pagingInfo.startIndex = count(local!allRemitentes) + local!pagingInfo.batchSize*/
                  /*)*/
                  /*)*/
                  
                ),
                linkStyle: "STANDALONE"
              )
            },
            showWhen: count(local!allRemitentes) > 10,
            align: "RIGHT"
          )
        },
        backgroundColor: "#f2f3f5"
      )
    )

Reply
  • 0
    Certified Associate Developer
    in reply to Konduru Chaitanya

    a!localVariables(
      local!numPagina: 0,
      local!re: 0,
      local!refresco: false,
      local!pagingInfo: a!pagingInfo(1, cons!AAC_C_BACTHSIZE),
    
      local!filtro,
      local!allRemitentes: rule!AAC_ER_getAllRemitentes(filtro: local!filtro),
      local!remitentes: a!refreshVariable(
        value: rule!AAC_ER_ObtenerRemitentesPaginados(
          pagingInfo: local!pagingInfo,
          filtro: local!filtro,
          refresco: local!refresco, 
        ),
        refreshAlways: true,
        refreshOnVarChange: { local!numPagina, local!refresco },
        refreshOnReferencedVarChange: false
      ),
      local!remitentesMod: local!remitentes,
      local!datosPagina: todatasubset(local!remitentesMod).data,
      local!remitentesBorrar: {},
      local!desactivarConfirmar: true,
      local!remitentesModBPM,
      local!exportDocId,
      local!mensajeError,
      a!headerContentLayout(
        header: {
          a!billboardLayout(
            backgroundMedia: a!documentImage(document: cons!AAC_C_IMAGEN_CABECERA),
            backgroundColor: "#f0f0f0",
            height: "SHORT_PLUS",
            marginBelow: "NONE",
            overlay: a!barOverlay(
              contents: {
                a!richTextDisplayField(
                  label: "Texto enriquecido",
                  labelPosition: "COLLAPSED",
                  value: {
                    a!richTextItem(
                      text: {
                        "Actualización Automática de Callsigns en Scena"
                      },
                      color: cons!AAC_C_COLOR_VERDE_AENA,
                      style: { "STRONG" }
                    )
                  }
                )
              },
              style: "DARK",
              padding: "STANDARD"
            )
          )
        },
        contents: {
          a!sectionLayout(
            contents: {
              a!sideBySideLayout(
                items: {
                  a!sideBySideItem(
                    item: a!textField(
                      placeholder: "Filtrar por correo o compañía...",
                      value: local!filtro,
                      saveInto: {
                        local!filtro,
                        a!save(local!numpagina, 0),
                        a!save(
                          local!pagingInfo,
                          a!pagingInfo(1, cons!AAC_C_BACTHSIZE)
                        ),
                        a!save(local!exportDocId, null)
                      },
                      refreshAfter: "UNFOCUS",
                      characterLimit: 50,
                      showCharacterCount: false
                    )
                  ),
                  a!sideBySideItem(
                    item: a!buttonArrayLayout(
                      buttons: a!buttonWidget(
                        label: "Exportar",
                        saveInto: a!exportDataStoreEntityToExcel(
                          entity: cons!AAC_C_ENTIDAD_REMITENTE,
                          filters: if(
                            a!isNotNullOrEmpty(local!filtro),
                            a!queryLogicalExpression(
                              operator: "OR",
                              filters: {
                                a!queryFilter(
                                  field: "email",
                                  operator: "includes",
                                  value: local!filtro
                                ),
                                a!queryFilter(
                                  field: "descripcion",
                                  operator: "includes",
                                  value: local!filtro
                                ),
                                a!queryFilter(
                                  field: "iata",
                                  operator: "includes",
                                  value: local!filtro
                                ),
                                a!queryFilter(
                                  field: "oaci",
                                  operator: "includes",
                                  value: local!filtro
                                )
                              },
                              ignoreFiltersWithEmptyValues: true
                            ),
                            null
                          ),
                          documentName: "Remitentes_" & now(),
                          saveInFolder: cons!AAC_C_EXPORTACIONES,
                          onSuccess: a!save(local!exportDocId, fv!newDocument),
                          onError: a!save(
                            local!mensajeError,
                            "Error al generar el fichero"
                          )
                        ),
                        style: "GHOST",
                        color: "#008000",
                        loadingIndicator: true,
                        showWhen: a!isNotNullOrEmpty(local!remitentes)
                      ),
                      align: "START"
                    )
                  )
                },
                marginBelow: "NONE"
              ),
              a!textField(
                label: "Contador refresco",
                labelPosition: "ABOVE",
                value: local!re,
                saveInto: local!re,
                refreshAfter: "UNFOCUS",
                validations: {}
              ),
              a!richTextDisplayField(
                value: {
                  a!richTextItem(
                    text: {
                      a!richTextIcon(icon: "download"),
                      "Descargar remitentes"
                    },
                    link: a!documentDownloadLink(document: local!exportDocId),
                    linkStyle: "STANDALONE"
                  )
                },
                showWhen: a!isNotNullOrEmpty(local!exportDocId)
              ),
              a!gridLayout(
                /*totalCount: count(local!remitentesMod),*/
                headerCells: {
                  a!gridLayoutHeaderCell(label: "Correo electrónico"),
                  a!gridLayoutHeaderCell(label: "IATA"),
                  a!gridLayoutHeaderCell(label: "OACI"),
                  a!gridLayoutHeaderCell(label: "Descripción"),
                  a!gridLayoutHeaderCell(label: "Usuario de alta"),
                  a!gridLayoutHeaderCell(label: "Fecha de alta"),
                  a!gridLayoutHeaderCell(label: "Usuario de modificación"),
                  a!gridLayoutHeaderCell(label: "Fecha de modificación"),
                  a!gridLayoutHeaderCell(label: "")
                },
                columnConfigs: {
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 3),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 2),
                  a!gridLayoutColumnConfig(width: "ICON")
                },
                rows: a!forEach(
                  items: local!datosPagina,
                  expression: a!gridRowLayout(
                    id: fv!index,
                    contents: {
                      /* Correo electrónico */
                      a!textField(
                        value: trim(
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email']
                        ),
                        saveInto: {
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email'],
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              loggedInUser(),
                              null
                            )
                          ),
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              now(),
                              null
                            )
                          ),
                          a!save(local!desactivarConfirmar, false)
                        },
                        refreshAfter: "UNFOCUS",
                        characterLimit: 100,
                        showCharacterCount: false,
                        required: true,
                        requiredMessage: "Campo obligatorio",
                        validations: {
                          if(
                            a!isNotNullOrEmpty(
                              rule!AAC_EC_ObtenerRemitentePorEmailNoID(
                                email: fv!item['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email'],
                                ID: fv!item['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              )
                            ),
                            "Ya existe este correo electrónico",
                            ""
                          ),
                          if(
                            validateemailaddress(
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email']
                            ) = false,
                            "Formato email inválido",
                            ""
                          ),
                          if(
                            a!isNullOrEmpty(
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email']
                            ),
                            "No puede dejar el campo vacío",
                            ""
                          )
                        },
                        validationGroup: "Remitente"
                      ),
                      /*IATA*/
                      a!textField(
                        value: local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dd131812-ae89-4a6d-80fe-571ed9fe0cdc}iata'],
                        saveInto: {
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dd131812-ae89-4a6d-80fe-571ed9fe0cdc}iata'],
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              loggedInUser(),
                              null
                            )
                          ),
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              now(),
                              null
                            )
                          ),
                          a!save(local!desactivarConfirmar, false)
                        },
                        refreshAfter: "UNFOCUS",
                        characterLimit: 3,
                        showCharacterCount: false,
                        required: true,
                        requiredMessage: "Especificar IATA",
                        validations: {
                          if(
                            regexmatch(
                              "^[A-Z]{3}",
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dd131812-ae89-4a6d-80fe-571ed9fe0cdc}iata']
                            ) = false,
                            "Introduzca un código IATA válido",
                            {}
                          ),
                          if(
                            a!isNullOrEmpty(
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dd131812-ae89-4a6d-80fe-571ed9fe0cdc}iata']
                            ),
                            "No puede dejar el campo vacío",
                            ""
                          )
                        }
                      ),
                      /*OACI*/
                      a!textField(
                        value: local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e95df776-1b43-4f70-ad7b-6b66c44930ea}oaci'],
                        saveInto: {
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e95df776-1b43-4f70-ad7b-6b66c44930ea}oaci'],
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              loggedInUser(),
                              null
                            )
                          ),
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              now(),
                              null
                            )
                          ),
                          a!save(local!desactivarConfirmar, false)
                        },
                        refreshAfter: "UNFOCUS",
                        characterLimit: 4,
                        showCharacterCount: false,
                        required: true,
                        requiredMessage: "Especificar OACI",
                        validations: {
                          if(
                            regexmatch(
                              "^[A-Z]{3}",
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e95df776-1b43-4f70-ad7b-6b66c44930ea}oaci']
                            ) = false,
                            "Introduzca un código IATA válido",
                            {}
                          ),
                          if(
                            a!isNullOrEmpty(
                              local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e95df776-1b43-4f70-ad7b-6b66c44930ea}oaci']
                            ),
                            "No puede dejar el campo vacío",
                            ""
                          )
                        }
                      ),
                      /* Compañia */
                      a!textField(
                        value: trim(
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ed5d29e9-0e3c-42bd-9676-08f94c230261}descripcion']
                        ),
                        saveInto: {
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ed5d29e9-0e3c-42bd-9676-08f94c230261}descripcion'],
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              loggedInUser(),
                              null
                            )
                          ),
                          a!save(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            if(
                              a!isNotNullOrEmpty(
                                local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                              ),
                              now(),
                              null
                            )
                          ),
                          a!save(local!desactivarConfirmar, false)
                        },
                        refreshAfter: "UNFOCUS",
                        characterLimit: 255,
                        showCharacterCount: false,
                        required: true,
                        requiredMessage: "Campo obligatorio",
                        validations: if(
                          a!isNullOrEmpty(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ed5d29e9-0e3c-42bd-9676-08f94c230261}descripcion']
                          ),
                          "No puede dejar el campo vacío",
                          ""
                        )
                      ),
                      /* Usuario de alta */
                      a!textField(
                        value: local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ca988606-2fda-4fe0-ab98-16d14909e377}creadoPor'],
                        readOnly: true
                      ),
                      /* Fecha de alta */
                      a!textField(
                        value: text(
                          local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e6141866-56fe-4f33-88bf-23405b40164b}creadoEn'],
                          cons!AAC_C_FORMATO_FECHAS
                        ),
                        readOnly: true
                      ),
                      /* Usuario de modificación */
                      a!textField(
                        value: local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{dc60bd83-d3b1-4aa4-ba7f-3ccc2feb8840}modificadoPor'],
                        readOnly: true
                      ),
                      /* Fecha de modificación */
                      a!textField(
                        value: if(
                          a!isNotNullOrEmpty(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn']
                          ),
                          text(
                            local!remitentesMod[fv!index]['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{3ddd11cd-69d9-440c-aebf-76d9a701131f}modificadoEn'],
                            cons!AAC_C_FORMATO_FECHAS
                          ),
                          null
                        ),
                        readOnly: true
                      ),
                      /* Botón para borrar. */
                      a!richTextDisplayField(
                        value: a!richTextIcon(
                          icon: "close",
                          altText: "Borrar " & fv!index,
                          caption: "Borrar " & fv!item['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e3de3045-5211-460a-91e8-667d01fc33ac}email'],
                          link: a!dynamicLink(
                            value: fv!index,
                            saveInto: {
                              a!save(
                                local!remitentesBorrar,
                                append(
                                  local!remitentesBorrar,
                                  local!remitentesMod[save!value]
                                )
                              ),
                              a!save(
                                local!remitentesMod,
                                remove(local!remitentesMod, save!value)
                              ),
                              a!save(local!desactivarConfirmar, false)
                            }
                          ),
                          linkStyle: "STANDALONE",
                          color: "NEGATIVE"
                        )
                      )
                    }
                  )
                ),
                addRowlink: a!dynamicLink(
                  label: "Añadir remitente",
                  value: {
                    'recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido'(
                      'recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{ca988606-2fda-4fe0-ab98-16d14909e377}creadoPor': loggedInUser(),
                      'recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{e6141866-56fe-4f33-88bf-23405b40164b}creadoEn': now()
                    )
                  },
                  saveInto: {
                    a!save(
                      local!remitentesMod,
                      append(local!remitentesMod, save!value)
                    ),
                    a!save(local!desactivarConfirmar, false)
                  }
                ),
                rowHeader: 1
              )
            }
          ),
          a!buttonArrayLayout(
            buttons: {
              a!buttonWidget(
                label: "Refrescar",
                saveInto: {
                  a!save(local!refresco, not(local!refresco)),
                  /*a!save(*/
                    /*local!remitentes,*/
                    /*rule!AAC_ER_ObtenerRemitentesPaginados(*/
                      /*filtro: local!filtro,*/
                      /*pagingInfo: local!pagingInfo,*/
                      /*refresco: local!refresco*/
                    /*)*/
                  /*),*/
                  /*a!save(*/
                    /*local!remitentesMod,*/
                    /*rule!AAC_ER_ObtenerRemitentesPaginados(*/
                      /*filtro: local!filtro,*/
                      /*pagingInfo: local!pagingInfo,*/
                      /*refresco: local!refresco*/
                    /*)*/
                  /*),*/
                  /*a!save(*/
                    /*local!datosPagina,*/
                    /*todatasubset(*/
                      /*rule!AAC_ER_ObtenerRemitentesPaginados(*/
                        /*filtro: local!filtro,*/
                        /*pagingInfo: local!pagingInfo,*/
                        /*refresco: local!refresco*/
                      /*)*/
                    /*).data*/
                  /*),*/
                  a!save(
                    local!allRemitentes,
                    rule!AAC_ER_getAllRemitentes(filtro: local!filtro)
                  ),
                  a!save(local!remitentesBorrar, {}),
                  a!save(local!desactivarConfirmar, true),
                  a!save(local!re, local!re + 1),
                  
                },
                color: cons!AAC_C_COLOR_VERDE_AENA,
                confirmHeader: "Refrescar",
                confirmMessage: "Los cambios NO confirmados se perderán.",
                confirmButtonLabel: "Aceptar",
                cancelButtonLabel: "Cancelar"
              ),
              a!buttonWidget(
                label: "Confirmar",
                saveInto: {
                  /* Prevenimos que confirmen dos veces. */
                  a!save(local!desactivarConfirmar, true),
                  /* Remitentes a borrar. */
                  a!save(
                    local!remitentesBorrar,
                    reject(
                      fn!isnull,
                      a!forEach(
                        items: local!remitentesBorrar,
                        expression: if(
                          a!isNullOrEmpty(fv!item),
                          null,
                          if(
                            a!isNotNullOrEmpty(
                              fv!item['recordType!{5070dc1c-b427-449c-b863-70714b785d78}AAC Remitente Permitido.fields.{fff4e416-1e78-45f6-90df-b9e384ddcaeb}ID']
                            ),
                            fv!item,
                            null
                          )
                        )
                      )
                    )
                  ),
                  /* 
                  Sólo nos quedamos con los nuevos remitentes (los que
                  tienen el campo ID vacío) o con aquellos remitentes
                  que se han modificado. Se considera que un remitente
                  se ha modificado cuando se modifica por primera vez
                  (no tenía fecha de modificación) o cuando la fecha de
                  modificación actual es mayor a la que venía de BBDD.
                */
                  /*en el proceso hay que comprobar si se cambió la compañia de vuelo en lugar del email, que en ese caso
                  para un contacto permitido ya registrado con email, no se le manda el email del alta*/
                  a!save(
                    local!remitentesModBPM,
                    difference(local!remitentesMod, local!remitentes)
                  ),
                  /*
                  Proceso que se encarga de eliminar, dar de alta y
                  modificar remitentes.
                */
                  a!startProcess(
                    processModel: cons!AAC_C_ACTUALIZAR_REMITENTES,
                    processParameters: {
                      remitentesBorrar: local!remitentesBorrar,
                      remitentesMod: local!remitentesModBPM
                    }
                  )
                },
                color: cons!AAC_C_COLOR_VERDE_AENA,
                disabled: local!desactivarConfirmar,
                validate: true,
                validationGroup: "Remitente",
                confirmHeader: "Confirmar cambios",
                confirmMessage: "Los cambios realizados se harán permanentes.",
                confirmButtonLabel: "Aceptar",
                cancelButtonLabel: "Cancelar"
              )
            },
            align: "END"
          ),
          a!richTextDisplayField(
            value: {
              a!richTextIcon(
                icon: "chevron-left",
                link: a!dynamicLink(
                  saveInto: {
                    a!save(
                      local!pagingInfo,
                      a!pagingInfo(
                        startIndex: local!pagingInfo.startIndex - local!pagingInfo.batchSize,
                        batchSize: local!pagingInfo.batchSize,
                        sort: local!pagingInfo.sort
                      )
                    ),
                    a!save(local!numPagina, local!numPagina - 1)
                  },
                  showWhen: local!pagingInfo.startIndex > 1
                ),
                linkStyle: "STANDALONE"
              ),
              a!richTextItem(
                text: {
                  char(32),
                  a!richTextItem(
                    text: {
                      joinarray(
                        {
                          property(local!pagingInfo, "startIndex"),
                          char(45),
                          if(
                            local!pagingInfo.startIndex = count(local!remitentesMod),
                            count(local!remitentesMod),
                            local!pagingInfo.batchSize * (local!numPagina + 1)
                          )
                        },
                        char(32)
                      )
                    },
                    style: "STRONG"
                  ),
                  char(32),
                  joinarray(
                    { "de", count(local!allRemitentes) },
                    char(32)
                  ),
                  char(32)
                }
              ),
              a!richTextIcon(
                icon: "chevron-right",
                link: a!dynamicLink(
                  saveInto: {
                    a!save(
                      local!pagingInfo,
                      a!pagingInfo(
                        startIndex: local!pagingInfo.startIndex + local!pagingInfo.batchSize,
                        batchSize: local!pagingInfo.batchSize,
                        sort: local!pagingInfo.sort
                      )
                    ),
                    a!save(local!numPagina, local!numPagina + 1)
                  },
                  showWhen: count(local!datospagina) = 10/*and(*/
                  /*local!pagingInfo.startIndex <= count(local!allRemitentes) - local!pagingInfo.batchSize,*/
                  /*not(*/
                  /*local!pagingInfo.startIndex = count(local!allRemitentes) + local!pagingInfo.batchSize*/
                  /*)*/
                  /*)*/
                  
                ),
                linkStyle: "STANDALONE"
              )
            },
            showWhen: count(local!allRemitentes) > 10,
            align: "RIGHT"
          )
        },
        backgroundColor: "#f2f3f5"
      )
    )

Children
No Data