Problem updating with WriteRecords

hi! I´m trying to update a field of a record with new data (stored in local variable in my interface and passed correctly as a rule input)

Even though the values are correctly saved, when I use the write records smart service it duplicates the rows and stores the value, with the rest of fields in null

I just want to update that field of my record, not to create new entries. Should I use the a!update function? How and where can I configure it in my code?

My interface code is the following:

a!localVariables(

  local!DatosLineas: a!queryRecordType(
    recordType: 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido',
    fields: {
      'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{fcfa4b36-4398-4430-8055-ecfa59daf13a}idLineaPedido','recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido', 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material','recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad', 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit', 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe', 'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{7fd4a6cb-f5b7-4f0f-9f86-1680005f8be5}CantidadPdteRecep'
    },
    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']
    ),
    pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 100)
  ).data
  ,
  local!DatosLineas2:{},
  local!DatosLineas3:{},
  {
    a!sectionLayout(
      label: "Datos Recepción",
      labelIcon: "dolly",
      contents: {
        a!columnsLayout(
          columns: {
            a!columnLayout(
              contents: {
                a!textField(
                  label: "Id Recepción",
                  labelPosition: "ABOVE",
                  value: ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{cb86a21e-a5e5-4ec7-98dc-14e94cc5736c}idRecepcion'],
                  saveInto: ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{cb86a21e-a5e5-4ec7-98dc-14e94cc5736c}idRecepcion'],
                  refreshAfter: "UNFOCUS",
                  validations: {}
                )
              }
            ),
            a!columnLayout(
              contents: {
                a!textField(
                  label: "Id Pedido",
                  labelPosition: "ABOVE",
                  value: ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{7309402c-2312-4a4e-bdaa-5654789bffb2}idPedido'],
                  saveInto: ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{4f22f1d7-f5cd-446a-90a2-64a5893f912b}idPedido'],
                  refreshAfter: "UNFOCUS",
                  validations: {}
                )
              }
            ),
            a!columnLayout(
              contents: {
                a!dateTimeField(
                  label: "Fecha y hora de Recepción",
                  labelPosition: "ABOVE",
                  value: ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{4fa92044-3c8b-438b-b77e-30bf88efbae3}FechaRecepcion'],
                  saveInto: ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{4fa92044-3c8b-438b-b77e-30bf88efbae3}FechaRecepcion'],
                  validations: {}
                )
              }
            )
          }
        )
      }
    ),
    a!sectionLayout(
      label: "Líneas Recepción",
      labelIcon: "list-alt-solid",
      contents: {
        a!gridLayout(
          label: "A continuación, introduzca las cantidades a recepcionar para cada línea de pedido y pulse el botón de Recepción",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Linea Pedido"),
            a!gridLayoutHeaderCell(label: "Pedido"),
            a!gridLayoutHeaderCell(label: "Material"),
            a!gridLayoutHeaderCell(label: "Cantidad Pendiente"),
            a!gridLayoutHeaderCell(label: "Precio Unitario"),
            a!gridLayoutHeaderCell(label: "Cantidad Recepcionada")
          },
          columnConfigs: {
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "ICON")
          },
          rows: a!forEach(
            items: local!DatosLineas,
            expression: a!gridRowLayout(
              contents: {
                a!textField(
                  value: fv!index,
                  readOnly:true
                ),
                a!textField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido'],
                  readOnly:true
                ),

                a!textField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material'],
                  readOnly:true
                ),
                a!integerField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{7fd4a6cb-f5b7-4f0f-9f86-1680005f8be5}CantidadPdteRecep'],
                  required: true,
                  readOnly:true,
                  validations: {
                  }
                ),
                a!floatingPointField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'],
                  required: true,
                  readOnly:true,
                  validations: {
                  }
                ),
                a!integerField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{bd0fe4ca-322c-422e-89e5-97e5194817a1}CantRecepAcum'],
                  saveInto: {fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{bd0fe4ca-322c-422e-89e5-97e5194817a1}CantRecepAcum']},
                  validations: if(isnull(fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{bd0fe4ca-322c-422e-89e5-97e5194817a1}CantRecepAcum']), "", if(fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{bd0fe4ca-322c-422e-89e5-97e5194817a1}CantRecepAcum']<=fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'], "", "La cantidad recepcionada debe ser igual o inferior a la cantidad de la línea de pedido"))
                  
                )

              }
            )
          )
        )
      }
    ),
    a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Completar Recepción",
          saveInto:{
          a!save(
            
              /*cambiar por recordLineasRecepciones*/
              local!DatosLineas2,
              a!forEach(
                local!DatosLineas,
                'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3'(
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{d7518970-ac55-44b5-b525-5a51247887cb}idRecepcion': ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{cb86a21e-a5e5-4ec7-98dc-14e94cc5736c}idRecepcion'],
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{15ae98c8-aae8-4e42-83ee-cc9f8a15054e}proveedor': ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{e11e6206-fc23-4a4b-9819-4db5a5bab685}nomProveedor'],
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{0a43fa95-c09b-4b60-9ae5-575d2528608e}createdOn': now() + intervalds(2,0,0),
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{c6c28a01-ff0f-4127-b8d5-58afe27e5a4e}createdBy': loggedInUser(),
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{8692352f-94c8-41c3-a9e8-b0e6e4357164}idLineaPedido': fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{fcfa4b36-4398-4430-8055-ecfa59daf13a}idLineaPedido'],
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{13436966-037d-4db1-9485-4a63ba64df7f}idPedido': fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido'],
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{4ed86221-1e35-41ab-af39-37897a6e45ca}material': fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material'],
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{8746ef15-c9ee-4f02-870a-72405fadf88c}precioUnit': fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'],
                  'recordType!{9340eead-a0d4-4504-93d9-b117f09a47d2}CPF Lineas Recepciones v3.fields.{403a1827-c369-495b-ba26-f0f31d1d7a59}cantidadRecep': fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{bd0fe4ca-322c-422e-89e5-97e5194817a1}CantRecepAcum'] )
              )    
            
              ),
              
              a!save(
                ri!recordLineasRecepV3,
                local!DatosLineas2
              ),
              a!save(

                /*cambiar por recordLineasRecepciones*/
                local!DatosLineas3,
                a!forEach(
                  local!DatosLineas,
                  'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido'(
                    'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{bd0fe4ca-322c-422e-89e5-97e5194817a1}CantRecepAcum': fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{bd0fe4ca-322c-422e-89e5-97e5194817a1}CantRecepAcum'] )
                )    

              ),

              a!save(
                ri!recordLineasPedido,
                local!DatosLineas3
              ),
        
              a!save(
                ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{4f22f1d7-f5cd-446a-90a2-64a5893f912b}idPedido'],
                ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{7309402c-2312-4a4e-bdaa-5654789bffb2}idPedido']
              ),
              
              a!save(ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{cad778de-1c66-4aca-9abf-ebea67e7f4d3}createdOn'], now() + intervalds(2,0,0)
              ),
              a!save(ri!RecordRecepciones['recordType!{b6fc6108-1f5d-4cbe-9c5c-08da4b1d58f3}CPF Maestro Recepciones.fields.{95377c9c-61d7-4677-89bb-3cc3e5150f05}createdBy'],loggedInUser())
          },
          submit: true,
          style: "PRIMARY",
          validate: true
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: "Cancelar",
          value: true,
          saveInto: ri!cancel2,
          submit: true,
          style: "NORMAL",
          validate: false
        )
      }
    )
  }
)

  Discussion posts and replies are publicly visible