I have two entities, let's call them Parent and Child, where I want the children to be name unique in the context of their single parent, but not name unique across all children. I figured this would need to be validated using a microflow on the Before Commit event for the Child entity, collecting the Parent entity and then checking its existing children. However, when I get a list based on Retrieving from the Association $Child/Parent_Child when creating a new child it is always empty. I guess the link may only be created after Before Commit has fired? Any ideas how I might achieve this? Thanks Phil
If you have a Child 1 --- 0 Parent relation, than you can use the retrieve activity, and use retrieve by association to find the parent. This way the association does not need to be stored in the database to use it.
Also, you do not need to retrieve a list and iterate over it, just retrieve for the same parent and matching name and retrieve the first entry - if it exists you have a duplicate, if not you are OK.
If I understand you correctly, you are trying to retrieve the parent's children from the Before Commit of a new child via on retrieve from association.
I suggest you retrieve the parent from the association and then use that to retrieve its children from the database.