This seems like a simple thing to do but I am running into issues.
So I have an external content type where I want to copy new items from and create items into my list.
The fields that my external content type has is an id field which is an integer column along with companycode and collectorcode.
My goal is to run a workflow that queries the items from the external content type and if these items do not exists in my list then I want the item to get created.
I've tried query BCS and it seems similar to that of Query list.
My issue is I am able to query and create items but it is also creating duplicate items.
So if it queries items and creates items with IDs:
And then 15 min later it my workflow queries and creates items again, then my list will have
This is query list action that is querying from my external content type , right now I am just querying one column , once I get the ids to populate correctly then I can work on the other columns:
And this is the next action ForEach
I am not sure what should go after the ForEach to prevent duplicates from being created in my list?
Solved! Go to Solution.
Hi Rency Gonzalez,
Within For Each loop, you query the Target list. Save the ID's in anther collection variable called collSPListID.
Create If action, If collSPListID <does not Contains> TargetID, then create the item. The drawback is querying the list again within the For Each.
If you are not doing anything with your target list items, then as a first step you can delete all the items in the list and then just create them again within For-Each loop.
Hope that helps.
This can be accomplished with comparing collections, either checking for existing items, or acting on the difference of the two collections (duplicates). With a bit of additional logic you should have no problem getting it to work in this way.