You can use the "find by microflow" option. This enables you to use a microflow to create the object (or search for it). In this microflow, you can also do stuff like set relations such as the ones you're talking about.
Hi Achiel, thanks for the answer. I guess you mean that in my domainmodel I can set actions for the entity. That is what I found. I thought an AfterCommit eventhandler would be the place to add a microflow. But when I tested this, it didn't work.
I finally could figure out (using breakpoint) that this event isn't fired when I use my xmlimport. It only fires when I add a new entity through a form.
The only place I need to set the association is when I import files in my application. It seems that eventhandlers of my entities are not the right place for this.
Any other suggestions?
Oke, I finally found it. After import I use a workflow to connect the association. I forgot the enable the commit.
All is working fine now.