How to retrieve non-persistent entities list with self-association

1
When I try to retrieve a list of non-persistent entities with self-association from a source "association" in a microflow, the list obtained is empty, even though the entity has data. Do you know what the cause of this is? Do non-persistent entities become empty when I do the Retrieve list again after filling it with data?   Best regards  
asked
2 answers
0

Hi Yuki,

 

How are you setting that association in first place? Can you elaborate?

answered
0

You must use a java action. There's absolutely no way to retrieve by reference with the reverse flag without a java action. Given your entity/association is named: SomeHelper/SomeHelper_SomeHelper you should write a java action taking the destination object of the reference as a parameter (the so called "child" ) and returning a list of source objects referencing the parameter (the so called "parents", also "association owners").

        // BEGIN USER CODE
        final boolean reverse = true;
        return Core
            .retrieveByPath(
                getContext(),
                child.getMendixObject(),
                SomeHelper.MemberNames.SomeHelper_SomeHelper.toString(),
                reverse);
        // END USER CODE

image.png

image.png

 

image.png

image.png

answered