Skip to main content
September 1, 2021
Solved

how to use a!writeToDataStoreEntity() write data into two tables simultaneously?

  • September 1, 2021
  • 20 replies
  • 1 view

as title, how can i add data to multiple table at same time by using a!writeToDataStoreEntity, give me a example code, thank you

    Best answer by nitesht9652

    As they are under same DS, it should have worked. Can you review your constant just to make sure they are using the entities from same DS and error message is still " The list of EntityData passed to the smart service contains entities from different data stores. All entities must belong to the same data store. No values have been written. (APNX-1-4208-001)".

    20 replies

    venkatasaisatyanarayanaraot000
    September 1, 2021

    HI 

    You can write to one Data base table using a!writeToDataStoreEntity() , where as you can use a!writeToMultipleDataStoreEntities() to write data to multiple data base tables 

    below is an example for the a!writeToMultipleDataStoreEntities()

    a!writeToMultipleDataStoreEntities(
    valuesToStore:{
    a!entityData(
    entity:/* DATA STORE ENTITY*/,
    data:/* DATA THAT NEED TO BE STORED*/
    ),
    a!entityData(
    entity:/* DATA STORE ENTITY*/,
    data:/* DATA THAT NEED TO BE STORED*/
    )
    }
    )

    Else if you are using process model then you can go with the Write to Data Store Entity Smart Service .

    docs.appian.com/.../Write_to_Multiple_Data_Store_Entities_Smart_Service.html

    September 1, 2021

    This way only store into the entity of first one, the second one didn't make any changes why?