An error occurred in executing an Activity Class

Hi! I have an interface in which the user can add new Rows. When the user clicks the "Completar creacion pedido" button, the values stored in my local variable are correctly passed to my rule input "recordLineasPedido". 

I leave here my structured code:

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
        )
      }
    )
  }
)

But when I try to use the write records smart service in the process model,  the following error appears:

My process model consists in two interfaces and the write record smart service to update each different record. My problem is with the marked objects/nodes:

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:

What can be causing this? Do i have a wrong configuration in the process model?

I´m posting this case in this topic because I think it suits better. Thanks a lot!

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

1- (First pic from the interface)

Form menu in the process model

SetUp menu in the writeRecords

Maybe I´m not passing the values in a correct way or with wrong format? Should I save each value from the local variable to a different ri! or can I do it passing the entire local variable to the rule input as I´m trying?

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Associate Developer

    Hi carlosp5114

    In case of Write Records smart service you have to map all the columns in script task node just before WriteRecords smart service. It will work that way.

    This is bug in WriteRecords smart service, it is behaving diffrently that WriteToDataStoreEntity smart service.

    Please try and see the results. Hope it will help you.

  • 0
    Appian Employee
    in reply to amritv308

    In the Write Records setup, you have correctly added the variable, but you also include a screenshot from the Data tab -> inputs, which does not need to be edited or configured in any way. You already did this in the setup tab. Also, what does your process variable look like? It's having trouble interpreting the variable as a list of this record type. 

    I don't know what bug you are referring to here as I'm not aware of any such issue. The record variable used by Write Records does need to be a list of records of the expected record type. Creating the variable in a script task or passing in from an Interface does not matter. 

Reply
  • 0
    Appian Employee
    in reply to amritv308

    In the Write Records setup, you have correctly added the variable, but you also include a screenshot from the Data tab -> inputs, which does not need to be edited or configured in any way. You already did this in the setup tab. Also, what does your process variable look like? It's having trouble interpreting the variable as a list of this record type. 

    I don't know what bug you are referring to here as I'm not aware of any such issue. The record variable used by Write Records does need to be a list of records of the expected record type. Creating the variable in a script task or passing in from an Interface does not matter. 

Children
No Data