Find duplicates in before commit event handler

0
Hi everyone, I’m trying to check if the new object that is being created already exists in a microflow that is executed before the object is committed.  This is my microflow:  Note that objects should be able to be exactly the same except for the teammember it is associated to. In the microflow that creates the object, it is associated to the teammember and given values for all it’s attributes. In the ‘contain’ activity, I check if the ProjectHoursList contains the ProjectHours object. The microflow is triggered before the object is committed, but I can’t seem to make it work properly (It seems to not commit any object at all using this microflow). Can anyone spot what I’m doing wrong and maybe provide some tips? Thanks in advance!
asked
2 answers
3

It requires far less database-activity if you do:

- Retrieve TeamMember from database with XPath-constraint [YourModule.ProjectHours_TeamMember = $ProjectHours].

- Aggregate list, Count.

If count = 0, you can commit, else don't.

answered
0

You’re retrieving ProjectHours by association. Maybe the new ProjectHours is therefore also (always) in that list. Try retrieving from database. The new one is not yet committed, else you could include an xpath constraint [id != $ProjectHours] to retrieve a list without the object you’re checking.

answered