I've posted a previous discussion but still no response, while I wait I am trying a different approach, im trying to input values into a writetodatastoreentity and i get this error:
Interface Definition: Expression evaluation error: An error occurred while executing a smart service: An error occurred while trying to write to the entity "cart" [id=7626554b-fee0-459d-b2d8-732f6e1bc7f5@3179, type=AS_Cart_DataBase (id=3784)] (data store: AS Data Store). Details: java.lang.IllegalArgumentException: The list of records to be saved must not be null or empty: TypedValue[it=3785,v={}] Data: TypedValue[it=3785,v={}]
I'm typing an a!save into the button saveinto I have 3 values and 2 0 like this: saveInto: a!writeToDataStoreEntity(cons!AS_DataStore_Cart_Pointer,{local!info.name,local!info.quantity,local!info.price,0,0}) am I doint something wrong?
Discussion posts and replies are publicly visible
Based on the error it seems that you are not providing a value to some column that is defined as non-nullable in database table and it may most likely be the primary key of the table. The expression should be as follows -
a!writeToDataStoreEntity( dataStoreEntity: cons!AS_DataStore_Cart_Pointer, valueToStore: /* local variable or rule input of CDT type which corresponds to data store entity above */ )
See below an example of how to use the Write to Data Store Entity Smart Service Function on an Interface -
https://docs.appian.com/suite/help/21.3/recipe-use-the-write-to-data-store-entity-smart-service-function-on-an-interface.html
I just changed to a!writeToDataStoreEntity(cons!AS_DataStore_Cart_Pointer,{1,1,1,1,1}) to test it out and its gives the same error, where should be the problem then?
Instead of giving values directly, set them by constructing the CDT using those values or use local variables or rule inputs of that CDT with those values. I am not sure what is the structure of your CDT, but for e.g. if there is an employee cdt with 3 fields (id, name, phone) you can use -
a!writeToDataStoreEntity( dataStoreEntity: cons!EMPLOYEE_ENTITY, /* just start typing type!your_cdt_name and appian will provide list of cdt's to choose from for the type constructor */ valueToStore: type!<namepace><cdt_name>(id: 1, name: "abc", phone: "1234567890"))
used local variables and it worked, still cant fully understand why but it does thank you