#GeneralInterest -: Hi all , I have one scenario, Let say i have one table

#GeneralInterest -: Hi all ,
I have one scenario, Let say i have one table Employee in this table, i have 3 columns RowId (Primary Key ),EmpId(int) and EmpName(text),EmpId and EmpName should be unique and from UI if two users are trying to insert same value at same time, then these entry should go as overwrite instead of creating two separate entries in database, I have tried using Unique Key constraint but if we are trying to insert same record which is exist in database that time write to database node is failing and i am getting “Unique key constraint violation error”, for work around i am checking record is exist in database or not, if yes then updating existing record on Write to Database node and also using unique key constraint ,but any other way to do this because two users are running flow simultaneously with same value so whose entry will go first that we are not sure?
Kindly suggest how to handle?

OriginalPostID-217893

OriginalPostID-217893

  Discussion posts and replies are publicly visible

Parents
  • @jasmins - I think creating an unique key constraint is absolutely fine. When you get an “Unique key constraint violation error” and the database node fails, you should configure an exception flow where you should get the already existing record and update it.
    Please refer below link for more information.
    https://forum.appian.com/suite/help/16.2/Exception_Flows.html
    Or else as suggested by karthikeyans75 you can first check whether the record already exists or not and then you can insert or update accordingly.
    Hope the information was helpful.
Reply
  • @jasmins - I think creating an unique key constraint is absolutely fine. When you get an “Unique key constraint violation error” and the database node fails, you should configure an exception flow where you should get the already existing record and update it.
    Please refer below link for more information.
    https://forum.appian.com/suite/help/16.2/Exception_Flows.html
    Or else as suggested by karthikeyans75 you can first check whether the record already exists or not and then you can insert or update accordingly.
    Hope the information was helpful.
Children
No Data