Possible bug trying to set mxObject property and retrieving it in microflow.

1
Hello everyone, I'm developing a custom widget for mendix. The widget creates new mendix object, sets its property(RackID) and displays a form for that object.   mx.data.create({ entity: ent, callback: function(obj){ // displayForm(obj._guid, widget, new context); var settings = {}; settings = getFormSettings(obj.jsonData.objectType, widget); obj.jsonData.attributes.RackID.value.c = widget._contextObj.jsonData.attributes.RackID.value.c.slice(); // .slice() is needed to create a COPY of the array instead of taking a refference var mxContext = new context; mxContext.setTrackObject(obj); var container = document.getElementById("form_container"); container.innerHTML = ""; mx.ui.openForm( settings.page, { domNode: container, context: mxContext }); }, The code above works exactly as it should. I get the form inside my container DIV. Inside the form I've placed a simple text widget to display the property: And this is what I get when I run it: That "2" on the right side is the "RackID" Property. The problem is that when I call a microflow with a "Show Message" action:   I am getting this result:   PS. I have a data grid  that uses the same form to create/edit items. When I edit an item the "Show message" window displays the right value for "RackID", so the problem is definitely in my widget somewhere.
asked
1 answers
1

I think you are better off using the official object API to set attributes. This makes sure the data actually ends up on the server as well. Seems like now you're only editing the obj.jsonData copy that was created for your specific widget. This means none of the other forms/widgets will see this and that it won't get send to the server.

Try this: https://apidocs.mendix.com/7/client/mendix_lib_MxObject.html#set

answered