Object Assignment in a microflow

0
Is there something like an object assignment or reference assignment activity?   For example, in typical programming languages, I do something like - var reference = null; if(condition){   reference = objectA; }else{   reference = objectB; } /* do something with reference */   How do I do something like this in my microflows? I can’t seem to create like an empty/null object reference. And also most operations like “Retrieve from Database” create a new Object, so I can’t reassign/overwrite an existing Object that I may have created. For example, the below won’t work :     So far, the workaround I’ve been using is having an empty list, adding my retrieved object to the list & then doing a HEAD operation on the list, cluttering up my whole flow, especially when there are multiple branches/nesting : For simpler flows like the above I just use multiple “End events”, but often the flow is more complex. Is there some simpler way to do the above?   
asked
4 answers
2

Such an action does not exist. There are some options to achieve what you need. One option is to create a submicroflow with multiple endpoints returning the object you need.

Another option is to create a list, add your object to the list and perform a head list operation after your merge action.

answered
0

You could edit the first object that you create with the data of the object you take from database, and use it as a reference. However you are still using ‘retrieves’ but don’t need to work with lists.

answered
0

You’d normally look at breaking the “if block” out into a submicroflow. The microflow will return a result you can easily use in your calling microflow. For example…

Hope this helps.

answered
0

Just create a (sub)microflow like below with the desired expression and set the object as return parameter. Use this microflow in a calling microflow and this way you always have the correct ‘Contact’ object and parameter available.

 

ReturnOrCreate_Contact:

Calling flow:

answered