As you stated, both should work. I believe the proper choice is to not return the object as it makes you have to manage multiple objects within your microflow.
Enzo,
In a microflow, you can retrieve the same object multiple times. Mendix 'knows' this is the same object. If you inspect the objects via debug, you'll see they have the same id.
If you want to know if two Microflow objects point to the same object in the database, you can simply compare them in an expression such as:
$Object_Copy1 = $Object_Copy2
This expression will evaluate to true if both Microflow objects point to a database object with the same id and it will evaluate to false if these Microflow objects point to different database objects.
If your submicroflows are updating different fields on the same object, I think the best approach for the question you posed is to not pass the objects back at the end of the microflow. You already have the object in your 'parent' microflow, and passing it back will incur additional processing cost by requiring that object to be
Hope that helps,
Mike
I think it all depends on what you want to do in the submicroflow. When I want to retrieve an object that might not exist yet I always use a submicroflow that does the retrieve by either giving back the retrieved object of when no object is found creating a new object and returning that one. This way you do not have the problem in your main microflow that you have two names $object or $newobject depending on the situation.
From a logic standpoint it is sometimes better to return the object and I always use then updated in the name of the return object. This makes following the logic of a microflow sometimes better, because you are not always aware that an object is changed in a submicroflow.
So I do not think their is a 'best' way. It all depends on what you are achieving and on how complex the microflows are.
My two cents on this subject.
Regards,
Ronald