


Hi,
Can anyone please confirm if the below approach is correct if we want to insert or update the data in a table using JS?
insertUpdateQuery = <order _key="@custId,@productName,@subProductName" _operation="insertOrUpdate" xtkschema = "cus:order"
productName = { productName }
subProductName = { subProductName }
custId = { custId }
productid= { productid}
datetime = { datetime }
/>
xtk.session.Write(insertUpdateQuery);
We are getting duplicate key value violates unique constraint errors in logs as during insertion or updation we can get data that might be already present based on the 3 key fields.
Based on my understanding if we use insertorUpdate operation it should not give a duplicate error. Can anyone please with this?
Version is V8
Thanks
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Sign in to like this content
Total Likes
Hi @ratika ,
Your write function and understanding related to "insertOrUpdate" operation are correct, as if there is a value that exists post the reconciliation of _key then the "insertOrUpdate" will update that record else it will insert.
Did you try to run the same js function in any other workflow to check if there are any caching/corruption issues in the current wkf?
Also, did you try to use _operation="update" (for testing) to observe if this also returns the same error of duplicate key?
Br,
Shubham
Hi @ratika,
Were you able to resolve this query or do you still need more help here? Do let us know.
Thanks
Views
Replies
Sign in to like this content
Total Likes