a!WriteRecords not working

Hi! I´m trying to write records using the a!writeRecords inside an interface. First of all, I save all the values of my editable grid in a local variable (local!LineasPedido), and I checked that, when i fill a number in the grid, the value is saved in the local variable correctly

After this, in the button configuration, I added a a!WriteRecords function inside the saveInto parameter of the button

My process model is the following one (First I fill some fields in a previous interface, upload the records with the WriteRecords Smart Service in the process) and then I continue filling and updating the PO lines directly from the interface. The interface exposed in which I upload the records directly with the code is marked in red

Logically, there is no value for the rule input of the second interface associated with the record type in which I´m saving the values (because I´m doing directly the write records in the interface over the local variable, not passing it to a rule input)

Here is the configuration of the interface shown (second one in the process model). 

The problem here is that, even though the records from the first interface of the process are being written correctly, the variables of the second one (marked in red) arent.

Here is the empty record in which I´m trying to save the values

What can be causing this problem? I know that maybe it is not a best practice to mix WriteRecords from the process and in the interface (Stefan told me), but it worked for me in previous ocassions (and I dont know how to convert the local variable, which can have several rows, into a rule input in the process model). 

The fact is that I dont know why is it failing now. As I said, the values are being correctly saved into the local variable when I check in the interface, but it is not writing to the record then.

I leave my code here:

a!localVariables(
  local!LineasPedido,
  {
    a!sectionLayout(
      label: "Líneas Pedido",
      labelIcon: "list-alt-solid",
      contents: {
        a!gridLayout(
          label: "A continuación, incorpore las líneas de pedido correspondientes y pulse el botón de creación",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Linea Pedido"),
            a!gridLayoutHeaderCell(label: "Pedido"),
            a!gridLayoutHeaderCell(label: "Proveedor"),
            a!gridLayoutHeaderCell(label: "Material"),
            a!gridLayoutHeaderCell(label: "Precio Unitario"),
            a!gridLayoutHeaderCell(label: "Cantidad"),
            a!gridLayoutHeaderCell(label: "Importe Total"),
            a!gridLayoutHeaderCell()
          },
          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: "DISTRIBUTE"),
            a!gridLayoutColumnConfig(width: "ICON")
          },
          rows: a!forEach(
            items: local!LineasPedido,
            expression: a!gridRowLayout(
              contents: {
                a!textField(value: {fv!index}, saveInto: {fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{fcfa4b36-4398-4430-8055-ecfa59daf13a}idLineaPedido']}),
                a!textField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido'],
                  saveInto: {
                    fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido']
                  }
                ),
                a!textField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{464f0883-d6d5-4c58-b054-4de8e9e99902}Proveedor'],
                  saveInto: {
                    fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{464f0883-d6d5-4c58-b054-4de8e9e99902}Proveedor']
                  }
                ),
                a!textField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material'],
                  saveInto: {
                    fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material']
                  }
                ),
                a!floatingPointField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'],
                  saveInto: {
                    fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'],
                    a!save(
                      fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe'],
                      if(
                        or(
                          isnull(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad']
                          ),
                          isnull(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                          )
                        ),
                        0,
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'] * fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                      )
                    )
                  },
                  required: true,
                  validations: {
                    if(
                      a!isNotNullOrEmpty(
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                      ) = false,
                      "",
                      if(
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'] < 0,
                        "El precio unitario debe ser superior a cero",
                        ""
                      )
                    )
                  }
                ),
                a!integerField(
                  value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'],
                  saveInto: {
                    fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'],
                    a!save(
                      fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe'],
                      if(
                        or(
                          isnull(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad']
                          ),
                          isnull(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                          )
                        ),
                        0,
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'] * fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                      )
                    )
                  },
                  required: true,
                  validations: {
                    if(
                      a!isNotNullOrEmpty(
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad']
                      ) = false,
                      "",
                      if(
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'] < 1,
                        "La cantidad debe ser superior a cero",
                        ""
                      )
                    )
                  }
                ),
                a!floatingPointField(
                  value: if(
                    or(
                      isnull(
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad']
                      ),
                      isnull(
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                      )
                    ),
                    0,
                    fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'] * fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                  ),
                  saveInto: {
                    fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe']
                  },
                  required: true,
                  validations: {
                    if(
                      a!isNotNullOrEmpty(
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe']
                      ) = false,
                      "",
                      if(
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe'] < 0,
                        "El importe debe ser superior a cero",
                        ""
                      )
                    )
                  },
                  align: "RIGHT"
                ),
                a!richTextDisplayField(
                  value: {
                    a!richTextIcon(
                      icon: "times-circle",
                      link: a!dynamicLink(
                        value: remove(local!LineasPedido, fv!index),
                        saveInto: local!LineasPedido
                      ),
                      linkstyle: "STANDALONE",
                      color: "NEGATIVE"
                    )
                  }
                )
              }
            )
          ),
          addrowlink: a!dynamicLink(
            label: "Añadir nueva Línea de Pedido",
            saveInto: a!save(
              target: local!LineasPedido,
              value: append(
                local!LineasPedido,
                'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido'(
                  'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido': ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{7309402c-2312-4a4e-bdaa-5654789bffb2}idPedido'],
                  'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{464f0883-d6d5-4c58-b054-4de8e9e99902}Proveedor': ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{e11e6206-fc23-4a4b-9819-4db5a5bab685}nomProveedor']
                )
              )
            )
          )
        )
      }
    ),
    a!buttonLayout(
      primaryButtons: {
        a!buttonWidget(
          label: "Completar Creación Pedido",
          saveInto: a!writeRecords(
            records: local!LineasPedido,
            onSuccess: {a!save(local!LineasPedido, fv!recordsUpdated) }
          ),
          submit: true,
          style: "PRIMARY",
          validate: true
        )
      },
      secondaryButtons: {
        a!buttonWidget(
          label: "Cancelar",
          value: true,
          saveInto: ri!cancel2,
          submit: true,
          style: "NORMAL",
          validate: false
        )
      }
    )
  }
)

Thanks a lot,

Carlos

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Just in the interface editor - if you add a row and click "Completar...", does the new entry not get written?  Are you confirming this directly via looking at the associated DB table?  Are all required columns being supplied a value?  Have you checked to see whether there are any errors in the system error log file (tomcat-stdout.log)? This could provide more detail (like identifying a missing value in a DB-required column, for instance).

    Also, for the sake of in-editor debugging you could also configure "onError" in a!writeRecords to save its value to a local variable you can set up for just this purpose, in case it provides any insight.

  • If I add a row and click "completar" nothing happens to the record. But yesterday it worked properly when running the process model! 

    ¿Where I can check the error log file? ¿Is it in the cloud database?

    And Mike, should I change my code and try to pass the local variable to the process model? I tried to put a Write Record Smart Service just after my second interface in the process model, but it gives me the following error, probably because I´m storing everything in the local data without passing it to a rule input:

    The error was like this but with the CPF Lineas Pedido 

    How can I save correctly the data and pass it to the process with my actual code? Because I´m not sure why the a!writeRecords of the interface is not working properly... In the morning I had another similar interface and worked, but since I added some source fields to the record (new columns) it´s not working too

  • 0
    Certified Lead Developer
    in reply to carlosp5114
    But yesterday it worked properly when running the process model! 

    Your current code isn't passing any data out to the process model so this would not be relevant.  In the current configuration it would be expected to work from within the interface editor if it's going to work at all.

    ¿Where I can check the error log file?

    https://docs.appian.com/suite/help/23.2/Logging.html

    should I change my code and try to pass the local variable to the process model?

    You need to decide which concept you're going to use and, really, only need to do one or the other.  If you're going to write your record data on-form using a!writeRecords(), then there's no need to pass it out to the process model.  If you'd rather pass it out to the process model and write it using the Write Records node, there's no need for a!writeRecords() on your interface.

    How can I save correctly the data and pass it to the process with my actual code?

    You would need to actually save the value stored in your local variable into the Rule Input prior to (or at) Form Submission, which you're not doing currently.

Reply
  • 0
    Certified Lead Developer
    in reply to carlosp5114
    But yesterday it worked properly when running the process model! 

    Your current code isn't passing any data out to the process model so this would not be relevant.  In the current configuration it would be expected to work from within the interface editor if it's going to work at all.

    ¿Where I can check the error log file?

    https://docs.appian.com/suite/help/23.2/Logging.html

    should I change my code and try to pass the local variable to the process model?

    You need to decide which concept you're going to use and, really, only need to do one or the other.  If you're going to write your record data on-form using a!writeRecords(), then there's no need to pass it out to the process model.  If you'd rather pass it out to the process model and write it using the Write Records node, there's no need for a!writeRecords() on your interface.

    How can I save correctly the data and pass it to the process with my actual code?

    You would need to actually save the value stored in your local variable into the Rule Input prior to (or at) Form Submission, which you're not doing currently.

Children
  • Alright, thanks a lot for the information. I´m trying to pass the local variable to a rule input and do everything this way. I´m using an a!save function but it is not working yet:

    When I click the submit button, the recordLineasPedido is still null. Is there another way or recommendation to pass the local variable to an RI? Do I have errors in my code?

    I let it here, I applied formatting to make it readable

    Thanks again!

    a!localVariables(
      local!LineasPedido,
      {
        a!sectionLayout(
          label: "Líneas Pedido",
          labelIcon: "list-alt-solid",
          contents: {
            a!gridLayout(
              label: "A continuación, incorpore las líneas de pedido correspondientes y pulse el botón de creación",
              headerCells: {
                a!gridLayoutHeaderCell(label: "Linea Pedido"),
                a!gridLayoutHeaderCell(label: "Pedido"),
                a!gridLayoutHeaderCell(label: "Proveedor"),
                a!gridLayoutHeaderCell(label: "Material"),
                a!gridLayoutHeaderCell(label: "Precio Unitario"),
                a!gridLayoutHeaderCell(label: "Cantidad"),
                a!gridLayoutHeaderCell(label: "Importe Total"),
                a!gridLayoutHeaderCell()
              },
              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: "DISTRIBUTE"),
                a!gridLayoutColumnConfig(width: "ICON")
              },
              rows: a!forEach(
                items: local!LineasPedido,
                expression: a!gridRowLayout(
                  contents: {
                    a!textField(value: {fv!index}, saveInto: {fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{fcfa4b36-4398-4430-8055-ecfa59daf13a}idLineaPedido']}),
                    a!textField(
                      value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido'],
                      saveInto: {
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido']
                      }
                    ),
                    a!textField(
                      value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{464f0883-d6d5-4c58-b054-4de8e9e99902}Proveedor'],
                      saveInto: {
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{464f0883-d6d5-4c58-b054-4de8e9e99902}Proveedor']
                      }
                    ),
                    a!textField(
                      value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material'],
                      saveInto: {
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{69e9a834-b2fb-4f35-a36d-3c526c97f4ac}Material']
                      }
                    ),
                    a!floatingPointField(
                      value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'],
                      saveInto: {
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'],
                        a!save(
                          fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe'],
                          if(
                            or(
                              isnull(
                                fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad']
                              ),
                              isnull(
                                fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                              )
                            ),
                            0,
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'] * fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                          )
                        )
                      },
                      required: true,
                      validations: {
                        if(
                          a!isNotNullOrEmpty(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                          ) = false,
                          "",
                          if(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit'] < 0,
                            "El precio unitario debe ser superior a cero",
                            ""
                          )
                        )
                      }
                    ),
                    a!integerField(
                      value: fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'],
                      saveInto: {
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'],
                        a!save(
                          fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe'],
                          if(
                            or(
                              isnull(
                                fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad']
                              ),
                              isnull(
                                fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                              )
                            ),
                            0,
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'] * fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                          )
                        )
                      },
                      required: true,
                      validations: {
                        if(
                          a!isNotNullOrEmpty(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad']
                          ) = false,
                          "",
                          if(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'] < 1,
                            "La cantidad debe ser superior a cero",
                            ""
                          )
                        )
                      }
                    ),
                    a!floatingPointField(
                      value: if(
                        or(
                          isnull(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad']
                          ),
                          isnull(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                          )
                        ),
                        0,
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{e78c5b35-026f-4713-8404-05077c6c9152}Cantidad'] * fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{47f4bf32-2e41-4c5a-a7e7-9fc7786bd753}PrecioUnit']
                      ),
                      saveInto: {
                        fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe']
                      },
                      required: true,
                      validations: {
                        if(
                          a!isNotNullOrEmpty(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe']
                          ) = false,
                          "",
                          if(
                            fv!item['recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{beb59a89-a332-46d3-b718-a8285f58f942}Importe'] < 0,
                            "El importe debe ser superior a cero",
                            ""
                          )
                        )
                      },
                      align: "RIGHT"
                    ),
                    a!richTextDisplayField(
                      value: {
                        a!richTextIcon(
                          icon: "times-circle",
                          link: a!dynamicLink(
                            value: remove(local!LineasPedido, fv!index),
                            saveInto: local!LineasPedido
                          ),
                          linkstyle: "STANDALONE",
                          color: "NEGATIVE"
                        )
                      }
                    )
                  }
                )
              ),
              addrowlink: a!dynamicLink(
                label: "Añadir nueva Línea de Pedido",
                saveInto: a!save(
                  target: local!LineasPedido,
                  value: append(
                    local!LineasPedido,
                    'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido'(
                      'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{71427dbb-12db-4f83-bd99-f625bf9af271}idPedido': ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{7309402c-2312-4a4e-bdaa-5654789bffb2}idPedido'],
                      'recordType!{495578a9-1b23-4253-8145-6418faabe727}CPF Lineas Pedido.fields.{464f0883-d6d5-4c58-b054-4de8e9e99902}Proveedor': ri!record['recordType!{3c95c0e4-e69d-43f6-b485-e72b24252af7}CPF Maestro Pedidos.fields.{e11e6206-fc23-4a4b-9819-4db5a5bab685}nomProveedor']
                    )
                  )
                )
              )
            )
          }
        ),
        a!buttonLayout(
          primaryButtons: {
            a!buttonWidget(
              label: "Completar Creación Pedido",
              saveInto:a!save(ri!recordLineasPedido, local!LineasPedido)
              ),
              submit: true,
              style: "PRIMARY",
              validate: true
            )
          },
          secondaryButtons: {
            a!buttonWidget(
              label: "Cancelar",
              value: true,
              saveInto: ri!cancel2,
              submit: true,
              style: "NORMAL",
              validate: false
            )
          }
        )
      }
    )

  • 0
    Certified Lead Developer
    in reply to carlosp5114
    I´m using an a!save function but it is not working yet

    What you have in your screenshot is about right, assuming your rule input is an array of that record type (and assuming the value in your local variable is getting the same thing correctly).  Just in case this is relevant, the current state of your code has an extra hanging close parenthesis, which would mess things up:

  • I revised and I had to put my rule input as an array, now the values are correctly saved in the rule input!

    But when I try to write record in the process model,  the following error appears:

    *(Update): I think that it has to be with how my ri! value from the interface is transferred

    Maybe I´m not passing the values in a correct way? Should I save each value from the local variable to a different ri!??

    My process model is:

    With the following variables (recordLineasPedido is the one I want to use to update the record "CPF Lineas Pedido"):

    My interface configuration is:

    And my writeRecords configuration is:

    Thanks a lot!

  • 0
    Certified Lead Developer
    in reply to carlosp5114

    Well, if you're trying to write a list of recordLineas, then this is wrong:

    And no matter what, this is wrong:

    I believe you can simply remove this item from the Inputs tab - the "Setup" tab is already taking care of selecting the record type PV value to be written.  Per the documentation: "The Data tab allows you to add additional inputs and store the resulting node outputs."