Copy Feature - copied entity instance not reflecting dropdown value

0
We have an interface which lists a subject's name and ID in a new_edit form. In the new_edit form, the dropdown calls a nanoflow on change to populate the associated user's id in a separate read-only field when the subject's name is selected in the dropdown. Entity subject relationship is a 1 to * association to Record Entity. Our microflow to create a Record entity works great and properly saves the subject's name and ID on edit and view summary details. Secondly, we created a separate microflow to copy the Record entity entry from an icon button in Records overview grid. The ID 4 appears in the read only ID field but the dropdown field (subject's name) remains blank i.e. not populated. I do believe we are unable to call a nanoflow from a microflow in the Mendix documentation as we do in the form, and was hoping to hear suggestions on how to set a value in a dropdown when we copy the Record?Thanks everyone!Bare Domain Model ScreenshotForm
asked
2 answers
0

hi,


This behavior occurs because the dropdown value is populated through an on-change nanoflow, while your copy functionality is executed through a microflow.

When a record is copied using a microflow, the nanoflow attached to the dropdown is not triggered, since on-change events are only executed during user interaction in the UI. As a result, the associated values that are normally filled by the nanoflow (such as the Subject ID field) are not automatically populated.

So the issue is not related to copying itself, but to where the logic is implemented.

Root Cause

Currently:

  • The dropdown selects TestSubject
  • An on-change nanoflow sets the related ID field
  • During copy, Mendix only duplicates or creates the object
  • UI events (on-change nanoflow) are never executed

Therefore, the dropdown association or dependent values remain empty.

Correct Approach

Business logic required for data consistency should not rely only on UI nanoflows. The same logic must exist in the microflow that creates or copies the object.

Working Solution

Update the Copy Record microflow to explicitly set the association and dependent values.

Step 1 – Create the New Record

Create a new SizingRecord.

Step 2 – Copy the Association

Set the subject association manually:



Change Object (NewSizingRecord)
Association:
SizingRecord_TestSubject = $OriginalRecord/SizingRecord_TestSubject

This step is essential because dropdown widgets store values through associations, not display text.

Step 3 – Populate the ID Field

Since the nanoflow will not run, set the ID directly in the microflow:



Change Object (NewSizingRecord)
TestSubjectId = 
$OriginalRecord/SizingRecord_TestSubject/SubjectId

or retrieve via association if needed.

Best Practice Recommendation

Avoid placing important data population logic only inside:

  • On-change nanoflows
  • Page events
  • UI widgets

Instead:

  • Keep UI logic in nanoflows
  • Keep business/data logic in microflows

This ensures functionality works correctly for:

  • Copy actions
  • Imports
  • Integrations
  • Scheduled events
  • Background processing

Conclusion

The dropdown value is not reflected because nanoflows are not executed during microflow-based copy operations. The correct solution is to explicitly copy the association and related attribute values inside the copy microflow rather than relying on the dropdown’s on-change nanoflow.


answered
1

Hey, sounds like when you copy the Record entity you're copying the attributes but not the association itself. The dropdown for the subject's name is driven by the association to the Subject entity, not by a plain string attribute. So in your copy microflow, make sure you're also setting the association (something like Record_Subject) to point to the same Subject object that the original Record was associated with. The ID field shows up because thats probably stored as an attribute directly on Record, but the dropdown needs the actual association to be set.


So in your copy microflow, retrieve the associated Subject from the original Record, then in the Change Object action for your new copied Record, set the association to that same Subject object. That should make the dropdown show the correct name without needing to call any nanoflow.

answered