hi,
In Mendix, JavaScript actions run on the client, and they receive object data from the client state only if the object’s current values are already stored in client memory. If the object you pass has uncommitted changes that are only in the nanoflow context, those changes may not be reflected when passed into the JavaScript action. This is a known behavior because the client API passed to JS can only see the object’s baseline state, not pending uncommitted changes.
This behavior is described in community threads where passing a newly created or changed object to JavaScript will only reflect correct values when the object is committed.
If you need to pass up-to-date values into the JavaScript action, do this:
Commit object (commit only the target object)JavaScript action with that objectThis ensures the JS action receives the latest values.
If you don’t want to commit, you can:
Example:
nameValue = $Object/NamenameValue into JS instead of the full objectThis works because simple values don’t depend on commit state.
In a browser, you can inspect the client state (Ctrl + Alt + G) to see what is currently stored and whether your uncommitted object is present. This confirms why the JS sees only the original values.
You can avoid committing the duplicate object by linking it to the latest object using a self-association. This ensures the duplicate remains referenced in the client context and is not lost before the JavaScript action is executed.
After duplicating the object, set a self-association from the latest object to the copy. This keeps both objects connected in memory without requiring a commit.
Then pass the latest object and the associated copy to the JavaScript action. Since the copy is still referenced through the association, Mendix will correctly provide its attribute values even without committing it to the database.