Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
+1
person also asked this
people also asked this
Replies
13 replies
Subscribers
8 subscribers
Views
3770 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
General
#GeneralInterest -: Hi all , I have one scenario, Let say i have one table
jasmins
over 8 years ago
#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
0
Sidhant Behura
over 8 years ago
@jasmins - In the exception flow of the sub process you can fetch the record with EmpId and EmpName(which are the unique keys) in script task and then made updations to the CDT and pass it to the "Write to Data Store Entity" node or create a subprocess with the DB Interaction process model and it will update the record. In other words, if id/primary key is already present it will update. You dont need to write any logic for that.
Please refer the screenshot and make updates/enhancements accordingly.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Reply
0
Sidhant Behura
over 8 years ago
@jasmins - In the exception flow of the sub process you can fetch the record with EmpId and EmpName(which are the unique keys) in script task and then made updations to the CDT and pass it to the "Write to Data Store Entity" node or create a subprocess with the DB Interaction process model and it will update the record. In other words, if id/primary key is already present it will update. You dont need to write any logic for that.
Please refer the screenshot and make updates/enhancements accordingly.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
Children
No Data