I cant retrieve list of objects in an after create microflow

0
Hi, I have an after create microflow that looks like this: Let's assume that I have 10 “Afspraak”-objects in my database. The strange thing is that when I run this microflow as an actual “after create” on the “Contract”-object (so configured in my data model), the first retrieve always returns an empty list and I do not get my desired result (the new “Contractafspraak” object, per “Afspraak”). However, when I run this microflow separately (from a button) the list does get filled. What causes this behavior and how do I deal with it? Update: the retrieve operation looks like this:
asked
4 answers
3

Hi Richard, 

I guess you are doing a retrieve from database with the contract as parameter for the retrieve. 
As the newly created contract has not been committed to the database yet, the result of the retrieve is an empty list, as the associations have not been set in the database. 

answered
1

I just created a test project in Mendix 7.8.0 for this use case, using default functionality (i.e. no custom create or save flows) ran it with no security, and it works as expected: if I have 3 afspraken, I retrieve them, I create and commit 3 contractafspraken en I can see them on my Contract_NewEdit page. Either something has changed between 7.8.0 and 7.23.3 and in this case you should file a ticket at support.mendix.com, or there is an error in your modelling (are you sure you have set the event handler?).

answered
0

I don't know the reason, but what is it that you try to do exactly? Seems a little bit odd to retrieve all the ‘Afspraak' objects and create new ‘Contractafspraak’ objects after a create of a ‘Contract’ with the use of an after create microflow?

Why not add this functionality to a custom save button after creating the contract?

answered
0

It is quite logical. This microflow is triggered immediately after the creation of the object. I assume you have a create and change in the same action? Because indeed the after create will run before the changes on the object and thus indeed are still empty because the changes have not been done yet on the object.

Regards,

Ronald

 

answered