Dynamically change member of Change Object activity

0
Problem Description I have a nanoflow where I repeatedly need to change members of an entity. Currently, I have multiple Change Object activities, each hardcoded to modify a specific member. The overall structure of the flow is going to be exactly the same for all members. I'd like to make this process more dynamic so that I can pass an attribute name as an input parameter to the nanoflow, eliminating the need to create separate nanoflows for each member. The standard Change Object activity doesn't allow directly selecting the member using a variable.   A view of ONE of my nanoflows - Meaning I need to edit 6 "Change Object" activities for EACH of the members. I am going to have to do this for at least 10 members, so keeping track and managing changes in the overall structure is going to be a nightmare.   If I have to create a nanoflow for each member, it's going to become unmanageable.   What I've Tried I researched ways to dynamically modify the selected attribute/member in nanoflows/microflows but haven't found a straightforward solution within the standard activities. Desired Solution I'm looking for guidance on the most efficient way to achieve this. I'd like to know if there are: Any workarounds using standard Mendix activities that I might have overlooked. Techniques to implement dynamic attribute selection (e.g., Decision activities, JavaScript actions). Additional Context I'm comfortable with Mendix development. I'm open to using JavaScript actions if that provides the best solution. Thank you in advance for your insights!
asked
3 answers
2

Hi Prontus,

Did you try creating an Enum variable and writing an if-else condition there??

and then setting the value based on the Enum?

 

Or maybe we can connect through google meet??

 

Let me know?

Hope it helps!

answered
0

Hello, 

 

I'm not sure where you want me to use the Enum, because nowhere in the "Change Object" dialogue can I put a dynamic value:

image.png

image.png

This image is just to further clarify the thing that I want to dynamically change.

 

Depending on a parameter of the flow itself, I want to change the member from NewAddressValidated to PrevAddressValidated (for example).

 

A practical example of the way of working I envision is: When I call the flow - I want to set the MemberToChange parameter to the member name, which in this case would be either "NewAddressValidated" or "PrevAddressValidated", and depending on which member I choose as the parameter, I can bind this parameter to the Change Object activity.

 

Thank you.

answered
0

With the addition of Primitive Variables in Mendix 10.13.0, this is no longer much of an issue. 

Now you can create a decision tree within one microflow to do different activities on different members. You still cannot conditionally choose which member within one change object activity, which I would love to see the possibility to do, but at least there's a greater reusability aspect in microflows now. 

Good job Mendix team! :)

answered