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

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

Thingworx UI Widget development - calling standard thingworx services inside widget code

amittal-3
13-Aquamarine

Thingworx UI Widget development - calling standard thingworx services inside widget code

Hello,

I am creating an external Thingworx widget, and am passing a Thingname (string) as a property of widget. Now inside widget I would like to call the generic services like 'GetBooleanPropertyValue' or 'GetIntegerPropertyValue' or for that matter any other custom service that I have defined in that Thing (Thing is created in composer).

I am not able to figure out a way to do so. What I have realised is , we have something like ..'TW.Runtime..' using which we can do so. for ex, if I need to access current session information I use something like 'TW.Runtime.Session.SetSessionValue'.

Also there is one more function, 'TW.IDE.getThingInfo' regrading which I am not able to find any details.

 

Another part to my question is , do we have any standard documentation/guide which provides information on list of Js functions like TW.Runtime or TW.IDE ...

I referred to https://community.ptc.com/t5/ThingWorx-Developers/Where-can-I-get-a-list-of-all-Thingworx-s-Js-function/td-p/518612, but as I can see in the post there is no such documentation avl. but it is also pointing to "Widget API: Mashup Builder" section of "Extension Development Guide", but there is no such detail which I am looking for.

Please let me know in case some more information/inputs are required.

Thanks in advance

Regards

Aditya Mittal

1 ACCEPTED SOLUTION

Accepted Solutions

I think, that's not how it's supposed to be developed a UI Widget, you should make widget bindables properties, and then at design time on the mashup bind the desired service (GetBooleanPropertyValue,...) to the bindable properties not the thing itself.  But if you want to continue with this approach, I think that if you look at Blog widget source code you will find ThingWorx API Calls.

View solution in original post

4 REPLIES 4

I think, that's not how it's supposed to be developed a UI Widget, you should make widget bindables properties, and then at design time on the mashup bind the desired service (GetBooleanPropertyValue,...) to the bindable properties not the thing itself.  But if you want to continue with this approach, I think that if you look at Blog widget source code you will find ThingWorx API Calls.

amittal-3
13-Aquamarine
(To:CarlesColl)

Thanks Carles for your response. I do appreciate the caution you pointed that UI widget should not be developed that way. But as of now I would still like to continue with my approach.

Also your suggestion to look into the code of BLOG widget actually helped and I got what I was looking for.

Blog widget mentions the use of "ThingworxInvoker", which is the way to call services inside widget Js code.

I have got the idea of how this works and will explore more on it. For starters it is good point.

My basic requirement is somehow to detect a change in property value (any custom property) of a thing, which is bound to my widget, so that I can avoid the use of auto refresh and perform the required action in widget only when necessary.

Thanks

Aditya

Hi Aditya,

 

Do you know the push properties feature on ThingWorx? for what you say it's exactly what you are looking for: Only update when property changes, it uses Websockets and should be the right way of doing it: http://support.ptc.com/help/thingworx_hc/thingworx_8_hc/en/#page/ThingWorx%2FHelp%2FMashup_Builder%2FMashups%2FMashupAutoUpdate.html%23

 

Best Regards,

Carles.

slangley
23-Emerald II
(To:CarlesColl)

Hi @amittal-3.

 

If one of the responses provided by @CarlesColl answered your question, please mark the appropriate one as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Top Tags