Widget MxObject.get(string) issue

1
I have a widget which is calling a microflow, getting an object back, and then it is attempting to get the value of one of the attributes of that object as follows (code snippet below): mx.data.action({   params: {     applyto: "selection",     actionname: this.dataSourceMicroflow,     guids: [ this._contextObj.getGuid() ]   },   store: {     caller: this.mxform    },   callback: dojoLang.hitch(this, function (obj) {     if(obj) {     var beginTimeValue = obj.get("Start"); And at this line in the code I get a JavaScript error: 'obj.get is not a function'. I can see that at this point 'obj' does exist, it is a Mendix object of the type I expect, it is not empty, and in the prototype it does in fact have a definition for a get() function that takes one argument. This is probably something stupid and obvious, but I can't quite figure it out. I should also note that this code works at least as of Mendix 6.10.2, but not now in Mendix 7. Perhaps I missed something about deprecated functionality or such. Any thoughts?
asked
1 answers
4

I'm able to replicate this issue in 7.2.0.
It appears that the argument passed to the callback is an array, regardless of the return type of the DS microflow (see example below).
Following examples in the client documentation, that behavior is not correct though..

In your case you should be able to access the attribute by obj[0].get("Start").
 

DS Microflow:

Action call:

mx.data.action({
  params: {
    applyto: "selection",
    actionname: "MyFirstModule.DS_MyMicroflow",
    guids: [ "3377699720527873" ]
  },
  callback: function (obj) {
	console.log(obj);
    if(obj.length) 
		console.log(obj[0].get("Name"));
	}
})

>> [Object]
>> Test
answered