Change a value of selected rows by clicking a button

Hi! I´ve made a read-only grid and used it in another interface. The read-only grid contains Purchase Order Lines. I would want to select some or all the rows (PO lines) and change their "Estado Recepción" value from "No Recepcionada" to "Recepcionada"

I searched and discovered the possibility to make the rows of the grid selectable. But for what I have seen, this only allows me to save the rows selected, not to change a value of the row directly.

¿Is there a way in appian to assign a button for each row and change a value of the row directly? ¿Or is it possible to put a checkbox component inside each row, so that when you click the checkbox, the status value changes?

If not, I was thinking about using the selection, put a button to save the selected rows, and create a process model to change the status of the selected rows

What do you think? Do you recommend me another option?

Thanks a lot!

  Discussion posts and replies are publicly visible

Parents Reply Children
  • To begin, I was trying to do another thing. By clicking a button (received Purchase Order --> Recepcionar Pedido), I want all the PO lines to be changed to the same status ("Accepted"), or what is the same, field "recepcionado" = true

    Now, the button is working for one of my records (in record 1 it changes the field "recepcionado" into true), but not for the record of PO lines, which is in a read-only grid (R2)

    I´m trying to save the values into the purchase order lines record but I think I´m missing a loop in the second save (I want multiple lines to be updated).

    Error: Interface Definition: Expression evaluation error [evaluation ID = MBB01] : An error occurred while executing a save: Expression evaluation error: Field with [identifier=a24a3b63-46ab-4829-a453-3ee10195424d] not found on the Record Type

    How can I introduce the loop in my code? Or is there another way to do it?

    Here is my code (line 259)

    {
      a!sectionLayout(
        label: "Detalle de información del pedido",
        labelIcon: "eye",
        labelSize: "MEDIUM",
        labelHeadingTag: "H2",
        labelColor: "#980000",
        contents: {
          a!columnsLayout(
            columns: {
              a!columnLayout(
                contents: {
                  a!textField(
                    label: "Nombre Proveedor",
                    labelPosition: "JUSTIFIED",
                    value: a!defaultValue(
                      ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{e11e6206-fc23-4a4b-9819-4db5a5bab685}nomProveedor'],
                      "–"
                    ),
                    readOnly: true
                  ),
                  a!sideBySideLayout(
                    items: if(
                      or(
                        isnull(
                          ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{176562ae-61d0-4316-bf57-a380b422e2dc}creadoPor']
                        ),
                        not(
                          isusernametaken(
                            ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{176562ae-61d0-4316-bf57-a380b422e2dc}creadoPor']
                          )
                        )
                      ),
                      a!sideBySideItem(
                        item: a!textField(
                          label: "Creado Por",
                          labelPosition: "JUSTIFIED",
                          value: "–",
                          readOnly: true
                        )
                      ),
                      {
                        a!sideBySideItem(
                          item: a!imageField(
                            label: "Creado Por",
                            labelPosition: "JUSTIFIED",
                            images: a!userImage(
                              user: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{176562ae-61d0-4316-bf57-a380b422e2dc}creadoPor']
                            ),
                            size: "TINY",
                            style: "AVATAR"
                          ),
                          width: "MINIMIZE"
                        ),
                        a!sideBySideItem(
                          item: a!richTextDisplayField(
                            labelPosition: "COLLAPSED",
                            value: a!richTextItem(
                              text: {
                                user(
                                  ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{176562ae-61d0-4316-bf57-a380b422e2dc}creadoPor'],
                                  "firstName"
                                ),
                                " ",
                                user(
                                  ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{176562ae-61d0-4316-bf57-a380b422e2dc}creadoPor'],
                                  "lastName"
                                )
                              },
                              link: a!userRecordLink(
                                user: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{176562ae-61d0-4316-bf57-a380b422e2dc}creadoPor']
                              )
                            )
                          )
                        )
                      }
                    ),
                    alignVertical: "MIDDLE"
                  ),
                  a!richTextDisplayField(
                    label: "Creado En",
                    labelPosition: "JUSTIFIED",
                    value: if(
                      isnull(
                        ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{6696e0ac-747d-4892-aacf-427e190ef104}creadoEn']
                      ),
                      "–",
                      {
                        a!richTextIcon(
                          icon: "calendar-o",
                          color: "SECONDARY"
                        ),
                        " ",
                        a!richTextItem(
                          text: text(
                            ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{6696e0ac-747d-4892-aacf-427e190ef104}creadoEn'],
                            "mmmm d, yyyy h:mm AM/PM"
                          )
                        )
                      }
                    )
                  ),
                  a!richTextDisplayField(
                    label: "Estado Pedido",
                    labelPosition: "JUSTIFIED",
                    value: if(
                      isnull(
                        ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{5fd66fe8-d4d2-48c3-b549-8074304081d1}Estado']
                      ),
                      "–",
                      {
                        a!richTextIcon(
                          icon: if(
                            ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{eeea3ae1-9516-46e3-8caa-327a9154b43d}recepcionado'],
                            "check-circle",
                            "times-circle"
                          ),
                          color: if(
                            ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{eeea3ae1-9516-46e3-8caa-327a9154b43d}recepcionado'],
                            "POSITIVE",
                            "NEGATIVE"
                          )
                        ),
                        if(
                          ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{eeea3ae1-9516-46e3-8caa-327a9154b43d}recepcionado'],
                          " Pedido Recepcionado",
                          " Pedido No Recepcionado"
                        )
                      }
                    )
                  )
                }
              ),
              a!columnLayout(
                contents: {
                  a!textField(
                    label: "Importe Total",
                    labelPosition: "JUSTIFIED",
                    value: if(
                      isnull(
                        ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{c450a9fc-1970-4f80-9735-899d5ca951e9}ImporteSumLineasPedido']
                      ),
                      "–",
                      text(
                        ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{c450a9fc-1970-4f80-9735-899d5ca951e9}ImporteSumLineasPedido'],
                        "#.##"
                      )
                    ),
                    readOnly: true
                  ),
                  a!sideBySideLayout(
                    items: if(
                      or(
                        isnull(
                          ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{ac8d9480-4ab2-4e47-a941-4c4a28338512}editadoPor']
                        ),
                        not(
                          isusernametaken(
                            ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{ac8d9480-4ab2-4e47-a941-4c4a28338512}editadoPor']
                          )
                        )
                      ),
                      a!sideBySideItem(
                        item: a!textField(
                          label: "Editado Por",
                          labelPosition: "JUSTIFIED",
                          value: "–",
                          readOnly: true
                        )
                      ),
                      {
                        a!sideBySideItem(
                          item: a!imageField(
                            label: "Editado Por",
                            labelPosition: "JUSTIFIED",
                            images: a!userImage(
                              user: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{ac8d9480-4ab2-4e47-a941-4c4a28338512}editadoPor']
                            ),
                            size: "TINY",
                            style: "AVATAR"
                          ),
                          width: "MINIMIZE"
                        ),
                        a!sideBySideItem(
                          item: a!richTextDisplayField(
                            labelPosition: "COLLAPSED",
                            value: a!richTextItem(
                              text: {
                                user(
                                  ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{ac8d9480-4ab2-4e47-a941-4c4a28338512}editadoPor'],
                                  "firstName"
                                ),
                                " ",
                                user(
                                  ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{ac8d9480-4ab2-4e47-a941-4c4a28338512}editadoPor'],
                                  "lastName"
                                )
                              },
                              link: a!userRecordLink(
                                user: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{ac8d9480-4ab2-4e47-a941-4c4a28338512}editadoPor']
                              )
                            )
                          )
                        )
                      }
                    ),
                    alignVertical: "MIDDLE"
                  ),
                  a!richTextDisplayField(
                    label: "Editado En",
                    labelPosition: "JUSTIFIED",
                    value: if(
                      isnull(
                        ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{1bafd378-a589-4d67-9f46-bd2b7208aa37}editadoEn']
                      ),
                      "–",
                      {
                        a!richTextIcon(
                          icon: "calendar-o",
                          color: "SECONDARY"
                        ),
                        " ",
                        a!richTextItem(
                          text: text(
                            ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{1bafd378-a589-4d67-9f46-bd2b7208aa37}editadoEn'],
                            "mmmm d, yyyy h:mm AM/PM"
                          )
                        )
                      }
                    )
                  ),
                  a!richTextDisplayField(
                    label: "Fecha de Emisión",
                    labelPosition: "JUSTIFIED",
                    value: if(
                      isnull(
                        ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{4097e2aa-8ce4-4ed1-9224-2ece219ef208}fechaEmision']
                      ),
                      "–",
                      {
                        a!richTextIcon(
                          icon: "calendar",
                          color: "SECONDARY"
                        ),
                        " ",
                        a!richTextItem(
                          text: text(
                            ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{4097e2aa-8ce4-4ed1-9224-2ece219ef208}fechaEmision'],
                            "mmmm d, yyyy"
                          )
                        )
                      }
                    )
                  )
                }
              )
            }
          ),
          a!buttonArrayLayout(
            buttons: {
              a!buttonWidget(
                label: "Completar RECEPCIÓN PEDIDO",
                saveInto: {
                  a!save(
                    ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{eeea3ae1-9516-46e3-8caa-327a9154b43d}recepcionado'],
                    true()
                  ),
                  a!save(
                    ri!record['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{a24a3b63-46ab-4829-a453-3ee10195424d}recepcionada'],
                    true()
                  ),
                  a!writeRecords(
                    records: ri!record
                  ),
                  a!writeRecords(
                    records: ri!recordLineasPedido
                  )
                },
                submit: true,
                style: "PRIMARY",
                validate:true
              )
            },
            align: "START"
          ),
          a!sectionLayout(
            label: "Desglose Líneas de Pedido",
            contents: {
              a!columnsLayout(
                columns: {
                  a!columnLayout(
                    contents: {
                      a!textField(
                        label: "Identificador de Pedido",
                        labelPosition: "ABOVE",
                        value: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{7309402c-2312-4a4e-bdaa-5654789bffb2}idPedido'],
                        saveInto: {},
                        refreshAfter: "UNFOCUS",
                        readOnly: true,
                        validations: {}
                      )
                    }
                  ),
                  a!columnLayout(
                    contents: {
                      a!floatingPointField(
                        label: "Total Pedido",
                        labelPosition: "ABOVE",
                        value: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{c450a9fc-1970-4f80-9735-899d5ca951e9}ImporteSumLineasPedido'],
                        saveInto: {},
                        refreshAfter: "UNFOCUS",
                        readOnly: true,
                        validations: {}
                      )
                    }
                  )
                }
              ),
              a!gridField(
                label: "",
                labelPosition: "ABOVE",
                data: a!recordData(
                  recordType: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido',
                  filters: a!queryLogicalExpression(
                    operator: "AND",
                    filters: {
                      a!queryFilter(
                        field: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido',
                        operator: "=",
                        value: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{7309402c-2312-4a4e-bdaa-5654789bffb2}idPedido']
                      
                      )
                    },
                    ignoreFiltersWithEmptyValues: true
                  )
                ),
                columns: {
                  a!gridColumn(
                    label: "Id Linea Pedido",
                    sortField: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{fcfa4b36-4398-4430-8055-ecfa59daf13a}idLineaPedido',
                    value: fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{fcfa4b36-4398-4430-8055-ecfa59daf13a}idLineaPedido'],
                    align: "START"
                  ),
                  a!gridColumn(
                    label: "Material",
                    sortField: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material',
                    value: fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material']
                  ),
                  a!gridColumn(
                    label: "Proveedor",
                    sortField: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{464f0883-d6d5-4c58-b054-4de8e9e99902}Proveedor',
                    value: fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{464f0883-d6d5-4c58-b054-4de8e9e99902}Proveedor']
                  ),
                  a!gridColumn(
                    label: "Precio Unit",
                    sortField: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit',
                    value: if(
                    isnull(fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']),
                    fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'],
                    fixed(fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'], 2)
                    ),
                    align: "END"
                  ),
                  a!gridColumn(
                    label: "Cantidad",
                    sortField: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad',
                    value: fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'],
                    align: "END"
                  ),
                  a!gridColumn(
                    label: "Importe",
                    sortField: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe',
                    value: if(
                    isnull(fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe']),
                    fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe'],
                    fixed(fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe'], 2)
                    ),
                    align: "END"
                  ),
                  a!gridColumn(
                    label: "Estado Recepcion",
                    sortField: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{ad1487f4-4ab4-4af6-8d4b-373e3864484a}EstadoRecepcion',
                    value: fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{ad1487f4-4ab4-4af6-8d4b-373e3864484a}EstadoRecepcion'],
                    align: "START",
                    width: "NARROW_PLUS"
                  ),
                  a!gridColumn(
                    label: "",
                    sortField: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{a24a3b63-46ab-4829-a453-3ee10195424d}recepcionada',
                    value: a!richTextDisplayField(
                      value: if(
                        fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{a24a3b63-46ab-4829-a453-3ee10195424d}recepcionada']=true,
                        {a!richTextIcon(
                          icon: "check-circle-o",
                          caption: "Overdue",
                          color: "POSITIVE",
                          size: "MEDIUM"
                        )},
                        if(
                          fv!row['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{a24a3b63-46ab-4829-a453-3ee10195424d}recepcionada']=false,
                          {a!richTextIcon(
                            icon: "times-circle-o",
                            caption: "Overdue",
                            color: "NEGATIVE",
                            size: "MEDIUM"
                          )},
                          {a!richTextIcon(
                            icon: "times-circle-o",
                            caption: "Overdue",
                            color: "NEGATIVE",
                            size: "MEDIUM"
                          )}
                        )
                      )
                    ),
                    align: "START",
                    width: "ICON"
                  )
                },
                selectable: true,
                selectionValue: ri!recordLineasPedido['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{a24a3b63-46ab-4829-a453-3ee10195424d}recepcionada'],
                validations: {},
                spacing: "STANDARD",
                refreshAfter: "RECORD_ACTION",
                showSearchBox: false,
                showRefreshButton: true,
                recordActions: {
                  a!recordActionItem(
                    action: 'recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.actions.{e98cfccd-1224-45ec-ac8f-115ea8bbe233}updateMaestroPedidos1',
                    identifier: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{7309402c-2312-4a4e-bdaa-5654789bffb2}idPedido']
                  ),
                  a!recordActionItem(
                    action: /*<add record action reference here>*/ null
                  ),
                  a!recordActionItem(
                    action: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.actions.{38bf8162-7cde-4fa7-a6a4-4b780ba9a6de}newLineasPedido'
                  )
                }
              )
            },
            marginAbove: "MORE"
          ),
          a!documentViewerField(
            label: " ",
            labelPosition: "ABOVE",
            document: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{eb7c0b96-8c37-4e52-bb0d-04a12be5abab}pedidoPDF'],
            height: "MEDIUM"
          )
        },
        divider: "ABOVE",
        dividerWeight: "MEDIUM",
        dividerColor: "#980000",
        marginAbove: "STANDARD",
        marginBelow: "MORE"
      )
    }

  • 0
    Certified Lead Developer
    in reply to carlosp5114

    Two things.

    First, you already know about the foreach() function. That's your loop.

    Second, you cannot call more than a single smart service function in a saveInto. As far as I can remember, this UI is assigned as a task to a user. Why not just modify the data in UI and write it to DB in process. We had this conversation already a while ago.