Issue related with a!writeToDataStoreEntity() function in interface level

Hi,

I have 2 forms in my application and I'm using one CDT for both the forms. I've used a!writeToDataStoreEntity() function  in submit button for storing the data. Once If I click on the submit button one row is inserting into the database.For the second form, If I click on the submit button a separate row is inserting instead of updating within the same row, the same issue is persisting with the other forms also.

Can you please suggest me to resolve this issue.

 

 

Even If I remove the a!writeToDataStoreEntity() function on second form and write the data using smart service then also new row is inserting. Its not updating with the existing row.

Thank you in advance!

 

 

Thanks,

Dharma

  Discussion posts and replies are publicly visible

Parents
  • Hi Dharma Rao (dharmaraok) ,

    By reading your description, there may be one of the following issue

    1) There a field in CDT which is declared as primary key (auto generate).
    i) The data is inserted into db first time and primary key id X is generated.
    ii) Trying to insert data second time without setting the primary key field value to X.
    Solution: Pass the CDT with primary key field set to X to second a!writeToDataStoreEntity() function

    2) There is no primary key field in CDT
    Solution: Add/make a field in CDT as primary key. Insert your data to db using first a!writeToDataStoreEntity() function, primary key id X is generated. While executing the a!writeToDataStoreEntity() function second time, set the primary key field value of CDT to X.
Reply
  • Hi Dharma Rao (dharmaraok) ,

    By reading your description, there may be one of the following issue

    1) There a field in CDT which is declared as primary key (auto generate).
    i) The data is inserted into db first time and primary key id X is generated.
    ii) Trying to insert data second time without setting the primary key field value to X.
    Solution: Pass the CDT with primary key field set to X to second a!writeToDataStoreEntity() function

    2) There is no primary key field in CDT
    Solution: Add/make a field in CDT as primary key. Insert your data to db using first a!writeToDataStoreEntity() function, primary key id X is generated. While executing the a!writeToDataStoreEntity() function second time, set the primary key field value of CDT to X.
Children
No Data