Showing results for 
Search instead for 
Did you mean: 
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

Use a Service from Thingworx


Use a Service from Thingworx



I am working on a project connecting Thingworx and Vuforia Studio.
Right now I'm trying to use a service imported from Thingworx. This service takes a string as input, and outputs the name of a Thing (this works well on Thingworx when I test my service), this allows me to call the Thing of my choice to display its data.


However after having imported this service in Vuforia Studio, and having made the connections which seem correct to me, the service does not run. The input string comes from a textInput and the output Thing goes into a Dynamic Entity Name to change the current Thing on the data display.
For the connections I have linked the text of the textInput to the input parameter of my service, and the output, the Current Selected Element, I redirect it to the Dynamic Entity Name of the displayed Thing to change the current Thing. But when I test, in Preview, and that I put a character string in the textIput, the service is not called because the displayed data does not correspond to those of the Thing that I ask (whereas if I put the name myself of a Thing in the Dynamic Entity Name, the display works as expected, so the problem seems to be with the service).


What do you think I am missing for my service to lunch?

What can I do to fix it?


Thank you for the support.




If I understand correctly you are setting the input from a text input box to a simple service that returns the Thingname. Do you have an event that causes the service to execute. For example you could use Value Changed event   



Thank you for your reply, you understand the situation correctly.
I have tried this exact same setup and nothing appears in the label when I enter something expected in the text input.

It is as if the service does not launch, despite the Value Changed event as a trigger for the service.

2 things make sure you tab out of the field otherwise you will not get a change event and second try binding the service the a button to make sure the service is executed. Check Thingworx script log for errors (add a log statement in the service to register execution). If non of this helps share your project and service and I will take a look

None of this solved my problem so I am sending you my project, thank you very much if you can take a look.
You will find my problem in the "AGV identification" view, in the 2D Overlay and the name of the service I am talking about is GetThingName.



I prefer to manage services in the js code. Here is one example where I start a service when open the expereince and then wait for the service to complete.


$scope.$on("$ionicView.afterEnter", function (event) {

$scope.$root.$broadcast('app.mdl.remoteDesignShareUtils.svc.getModelURL',{"OID" : $['partOID']});

$scope.$on('getModelURL.serviceInvokeComplete', function() {

$scope.view.wdg['model-4']['src'] = $['remoteDesignShareUtils'].svc['getModelURL'].data.current['result'];



@SebastienV I looked at your example and If I understand you was wanting a user to enter a Thing name and then navigate to a new view - I can't try it out as I don't have access - so I put together a video that I help helps - let me know 

Thank you very much for your reply, my problem is now solved.


If I understand correctly, the problem was that the service didn't start systematically before I changed the View, and once I went to the next View the service could not be started anymore.

The solution is to check both "Auto-select first row" and "Auto-refresh" (1 sec as rate) in the Configuration section of the service.





Once again thank you very much for the support.



Sounds good glad it was helpful. 

Another thought I might be tempted to use application parameters and store the name entered in application param CURRENT_SELECTED

This value is a global value across all views.


If you have a model in the view you are navigating too you can use model loaded event to execute the getname service with CURRENT_SELECTED as the binding to the input parameter. This could remove to 1 sec constant getname execution which is really a   resource hog

Top Tags