Skip to main content
July 26, 2023
Question

writeToDataStoreEntity vs writeToMultipleDataStoreEntities

  • July 26, 2023
  • 11 replies
  • 0 views

it saves when I use this:

a!writeToDataStoreEntity(
              dataStoreEntity: cons!AF_EXCELPIPELINE_CONS,
              valueToStore: local!pipelinetest
            )

but does not save when I use this: 

a!writeToMultipleDataStoreEntities(
              valuesToStore: {
                a!entityData(
                  entity: cons!AF_EXCELPIPELINE_CONS,
                  data: local!pipelinetest
                )
              }
            )

why is that so?

    11 replies

    sushilk061231
    July 26, 2023

    writeToMultipleDataStoreEntities, is looking for multiple entity data store to establish FK relationship,  this function not work if provide  single entity... that why there are 2 function provided by Appian.   

    July 26, 2023

    I also tried with 2 different entities, but didn't work. what is FK btw?

    dharmagyaa1662
    July 26, 2023

    Here FK refers to foreign key

    dharmagyaa1662
    July 26, 2023

    The a! writeToMultipleDataStoreEntities method writes multiple CDT values to multiple entities within the same data store based on your input. Make sure your parameters are correct.

    Here's an example of using a!MultiDataStoreEntities to store data from local variables on the click of a button.

    a!localVariables(
      local!name: a!map(name: "D", age: 18),
      a!buttonWidget(
        label: "Submit",
        saveInto: {
          a!writeToMultipleDataStoreEntities(
            valuesToStore: a!entityData(
              entity: cons!DAF2_consProm,
              data: local!name
            )
          )
        }
      )
    )

    July 26, 2023

    a!writeToMultipleDataStoreEntities(
                  valuesToStore: {
                    a!entityData(
                      entity: cons!AF_EXCELPIPELINE_CONS,
                      data: local!pipelinetest
                    ),
                    a!entityData(
                      entity: cons!AF_EXCELTASK_CONS,
                      data: local!tasktest
                    )
                  }
                )

    this is my code. I have verified that both EXCELPIPELINE and EXCELTASK are in the same data store

    mathieud0001
    Brainy
    July 26, 2023

    Code looks fine as far as I can tell.

    Maybe check both your constants and make sure they are pointing to the DSE.

    Also make sure there isn't some constraint on the database that may be preventing the insert.