Error: variable(s) not found: local!data

Hi! I created an interface with an editable grid so that the user can add invoice line information and new rows. When clicking the button of confirmation, the rows must be saved into a record ([]). The interface runs in a perfect way when I test it (all the values I write are stored in local!data) , but when I try to add it to the process model an error appears : 

Image of the error related with local variables (local!data):

To create the interface I followed the steps of an Appian tutorial ("Write or Delete Records using an Editable Grid | Editable Grids, Part 2"):

https://www.youtube.com/watch?v=z0FF9aCZRBE

In the tutorial, we store the inserted values in a local variable (local!data), to end passing the information to the record. I leave here the code:

a!formLayout(
  label: "Crear Nueva Factura (2/2)",
  contents: {
a!localVariables(
  local!data,
  {
    a!sectionLayout(
      label: "Información de Línea de Factura",
      contents: {
        a!gridLayout(
          label: "A continuación, incorpore las líneas de factura correspondientes y pulse el botón de creación",
          headerCells: {
            a!gridLayoutHeaderCell(label: "Id Factura"),
            a!gridLayoutHeaderCell(label: "Id Pedido"),
            a!gridLayoutHeaderCell(label: "Importe"),
            a!gridLayoutHeaderCell(label: "Proveedor"),
            a!gridLayoutHeaderCell()
          

          },
          columnConfigs: {
            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!data,
            expression: a!gridRowLayout(
              contents: {
                a!textField(value:fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{14eaacbb-19fc-41e2-aea2-3ec9b3322722}idFactura'], saveInto: fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{14eaacbb-19fc-41e2-aea2-3ec9b3322722}idFactura']),
                a!textField(value:fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{0674a81d-2d41-4f90-a871-1f29f4283a6e}idPedido'], saveInto: fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{0674a81d-2d41-4f90-a871-1f29f4283a6e}idPedido']),
                a!floatingPointField(value:fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{afbd0300-a83f-4cd5-8de9-740dab7d0ec8}totalPedidoFact'], saveInto: fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{afbd0300-a83f-4cd5-8de9-740dab7d0ec8}totalPedidoFact']),
                a!textField(value:fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{92d3b685-0289-4393-9c7e-c63a963dfa73}proveedor'], saveInto: fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{92d3b685-0289-4393-9c7e-c63a963dfa73}proveedor']

                ),
                a!richTextDisplayField(
                  value: {
                    a!richTextIcon(
                      icon: "times-circle",
                      link: a!dynamicLink(
                        value: remove(local!data, fv!index),
                        saveInto: local!data
                      ),
                      linkstyle: "STANDALONE",
                      color: "NEGATIVE"
                   )
                    
                  }
                )
                
              }
            )
          ),
          addrowlink: a!dynamicLink(
            label: "Add new Invoice Line",
            value: append(
              local!data,         
              'recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura'()
            ),
            saveInto: local!data
          )
        )
      }
    )
  }  
)   
},
  buttons: a!buttonLayout(
    primaryButtons: {
      a!buttonWidget(
        label: "Completar Creación Factura",
        saveInto: a!writeRecords(
          records:local!data,
          onSuccess: a!save(local!data, fv!recordsUpdated)
        ),
        submit: true,
        style: "PRIMARY",
        validate:true
      )
    },
    secondaryButtons: {
      a!buttonWidget(
        label: "Cancelar",
        value: true,
        saveInto: ri!cancel,
        style: "NORMAL"
      )
    }
  )
)

Even though I have no exact idea of the error, I searched in the community and found that the local variables cant be passed to the process model directly. How can I afford this situation in order to solve my problem! If I have to transform my local data into a rule input or something else, where can I find an step-by step guide?

Thank you so much

  Discussion posts and replies are publicly visible

Parents Reply Children
  • Thank you so much for your answer! I have put the local variable outside the form, as you said, so the error I mentioned has dissapeared. But now another error has come in the step to write the data introduced into the record: 

    As before, I leave the new code of the interface:

    a!localVariables(
      local!data,
      {
            a!gridLayout(
              label: "A continuación, incorpore las líneas de factura correspondientes y pulse el botón de creación",
              headerCells: {
                a!gridLayoutHeaderCell(label: "Id Factura"),
                a!gridLayoutHeaderCell(label: "Id Pedido"),
                a!gridLayoutHeaderCell(label: "Importe"),
                a!gridLayoutHeaderCell(label: "Proveedor"),
                a!gridLayoutHeaderCell()
              
    
              },
              columnConfigs: {
                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!data,
                expression: a!gridRowLayout(
                  contents: {
                    a!textField(value:fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{14eaacbb-19fc-41e2-aea2-3ec9b3322722}idFactura'], saveInto: fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{14eaacbb-19fc-41e2-aea2-3ec9b3322722}idFactura']),
                    a!textField(value:fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{0674a81d-2d41-4f90-a871-1f29f4283a6e}idPedido'], saveInto: fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{0674a81d-2d41-4f90-a871-1f29f4283a6e}idPedido']),
                    a!floatingPointField(value:fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{afbd0300-a83f-4cd5-8de9-740dab7d0ec8}totalPedidoFact'], saveInto: fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{afbd0300-a83f-4cd5-8de9-740dab7d0ec8}totalPedidoFact']),
                    a!textField(value:fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{92d3b685-0289-4393-9c7e-c63a963dfa73}proveedor'], saveInto: fv!item['recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura.fields.{92d3b685-0289-4393-9c7e-c63a963dfa73}proveedor']
    
                    ),
                    a!richTextDisplayField(
                      value: {
                        a!richTextIcon(
                          icon: "times-circle",
                          link: a!dynamicLink(
                            value: remove(local!data, fv!index),
                            saveInto: local!data
                          ),
                          linkstyle: "STANDALONE",
                          color: "NEGATIVE"
                       )
                        
                      }
                    )
                    
                  }
                )
              ),
              addrowlink: a!dynamicLink(
                label: "Add new Invoice Line",
                value: append(
                  local!data,         
                  'recordType!{b83ae990-aa66-4847-b974-1e1e40019294}CPF Maestro Líneas Factura'()
                ),
                saveInto: local!data
              )
            )
    ,
      a!buttonLayout(
        primaryButtons: {
          a!buttonWidget(
            label: "Completar Creación Factura",
            saveInto: a!writeRecords(
              records:local!data,
              onSuccess: a!save(local!data, fv!recordsUpdated)
            ),
            submit: true,
            style: "PRIMARY",
            validate:true
          )
        },
        secondaryButtons: {
          a!buttonWidget(
            label: "Cancelar",
            value: true,
            saveInto: ri!cancel,
            style: "NORMAL"
          )
        }
      )
    
    }
    )

    I revised the inputs and all of them are in the record type. I don´t know what is generating this error. 

    Again, thank you so much!

  • 0
    Certified Lead Developer
    in reply to carlosp5114

    The data should be getting written here, so I'm unclear why you're trying to do it a second time in a Process Model node.  Are you saying you want to do it in the process model instead of on Submit Click?

    Edit to add: what node is actually causing the failure?  How exactly is it configured?  I can't tell much from your process instance screenshot.

  • Hi! The node which is causing the failure is the second one:

    I tried to remove the second "write records" node and the first part of the process is OK (user enters fields in the first interface, they are saved correctly in my first record and after that, a second interface appears), but the fields in my second interface "Cubrir Formulario" are not saved in the second record.

    • Configuration of "Cubrir formulario lineas fact":

    • Configuration of "Rellenar base datos lineas":

    I tried to remove the second "write records" node and the first part of the process is OK (user enters fields in the first interface, they are saved correctly in my first record and after that, a second interface appears), but the fields in my second interface "Cubrir Formulario" are not saved in the second record.