Hi All,
code:-
Discussion posts and replies are publicly visible
valueToStore: union(local!items, local!items)
That's the absolute fastest way it could possibly be done. Let me know if that doesn't work, we'll have to go through a more thorough way of removing duplicates.
when I am clicking on the first-time create button, it is not creating any duplicates, when i am clicking on the second time it not verifying whether the record is already present or not and not to insert the already existing data.
Without fully digesting all of your code, this can occur if you are not populating the unique ID values for existing rows before writing the CDT to the DB, so Appian does not realize this should not be a re-entry (update vs insert). If there is no need to update entries, you would want to query for which values are already in the DB, and remove those from the CDT before persisting your data.
I think it would be WONDERFUL feature if Appian allowed a way to configure DB node or function to ONLY write or ONLY update, else throw error and pause the process / pink box. The fact that it's determined at runtime, even though via very explicit and predictable rules, does lead many a developer to problems like this, and adds a bunch of time for all of us to trick it into only doing what we want.