Call Service on Platform from Extension Widget
I am looking to make a call from within an extension widget to a service on the platform. Namely, I am looking to get the current user identity and some other tasks (which are handled by MyService) and use that internally in the widget to control certain parts of the html (such as hiding or showing buttons). So far I have referenced these two posts as well some of the SDK.
I have had minor success with the ThingworxInvoker at least returning a table as opposed to the second method of using processServiceRequest (causes the widget to fail). The difficulty I am having is accessing the data in the table.
My current call is like so
var invoker;
var success = function (invoker) {
var dataFromInvoke = invoker.result;
var rows = invoker.result.rows;
var nRows = rows.length;
TW.Runtime.showStatusText('testmessage','Number of Rows: ' + nRows);
};
var fail = function (invoker, xhr) {
TW.log.error('GetComments failed');
TW.Runtime.showStatusText('error', 'Error"' + xhr.responseText + '"');
};
invoker = new ThingworxInvoker({
entityType: 'Things',
entityName: 'MyThing',
characteristic: 'Services',
target: 'MyService',
apiMethod: 'POST',
});
invoker.invokeService(success, fail);
I see the correct number of rows being returned from the message. I have tried using the typical rows[index] and row[index].MyDataShapeProperty and neither method has worked.
Has anyone had success with the ThingworxInvoker and returning data and how?
Additionally, I am aware I could use bindable properties to bring in data but it is undesirable to require additional setup for widget for something should be a part of the basic functionality.

