Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X
I am developing my own experience in Thingworx studio. I just want to use Java script to invoke my custom Thingworx service with a parameter input. Thanks very much.
If you are looking to get the data from a ThingWorx service, then it can be done as:
var result = $scope.app.mdl['Thingname'].svc['servicename'] ;
// which invokes the service and returns the service output
And to assign the parameter value -
$scope.app.mdl['Thingname'].data.parameter['parametername'] = "input value" ;
In order to invoke service with the required input parameter, you can try assigning the parameter first and in the next step invoke the service execute step.
-Giri
Hi, Giri. If i use script to set parameter like: $scope.app.mdl['ServiceItem-1'].data.parameter['currentStep'] = 'xxxxx', debug console will report error "TypeError: Cannot read property 'parameter' of undefined".
I am facing the same issue. What would be the reason that the thing is undefined in javascript? but when I bind a property from the very same thing directly to some widget I get the property values as expected.
Hi,
When I console.log the content of mdl object in the home.js as below:
console.log($scope.app.mdl);
I get the object nicely logged in the console
If I then copy the path to the BatteryCharge property (just under the pop-up) and try to log its value as follows:
console.log($scope.app.mdl.KCERoofBox.properties.BatteryCharge);
I'll get the following error:
So it seems that the KCERoofBox object is undefined.
What am I doing wrong?
I've also tried the following call with the same results:
console.log($scope.app.mdl['KCERoofBox'].properties['BatteryCharge']);
Please could someone help me out with this one?
Br,
Antti