Skip to main content
1-Visitor
Jun 11, 2018 8:39 AM UTC
Solved

Unable to add new property programatically using service AddPropertyDefinition in Thingworx

Hello,

I need to add couple of new properties to my Things at run-time. To achieve this I have tried using "AddPropertyDefinition" service from my composer environment. I am using ThingWorx 8.1.0. I sought references from various topics like - 

https://www.ptc.com/en/support/article?n=CS233812

 

https://support.ptc.com/help/thingworx_hc/thingworx_8_hc/index.html#page/ThingWorx/Help/Composer/Things/ThingProperties/ProgrammaticallyAddingPropertiestoThings.html

 

https://community.ptc.com/t5/ThingWorx-Developers/Thing-addProperty-doesn-t-work/m-p/527530#M21446

 

As mentioned in one of the links that it is needed to restart the Thing, I tried doing that, but doesn't work for me.

The execution of this service does not return any error, but does not give the expected output as well.

I tried to also use this service using "Test Service" button against the same service listed under generic services for a Thing.

Any possible reasons for the same?

Regards

Aditya Mittal

1-Visitor
Jun 11, 2018 10:41 AM UTC

Why not a custom service? please do it with the custom service where you can do a thing Restart right on.

8 replies

1-Visitor
Jun 11, 2018 9:29 AM UTC

Can you share your code?

Translate
amittal-31-VisitorAuthor
1-Visitor
Jun 11, 2018 10:10 AM UTC

Hi Carles,

I am not doing it by any custom service, I am first trying to add the property using the "Test" service option (attached screen shot for reference) for a Thing (based on generic Thing template). I have filled in the required values like name, basetype and description. Service execution seems successful (as there is no exception or error). But still the property is not added in my thing.

Please let me know in case any other information is required from my end to better understand the issue.

Thanks

Aditya

Translate
1-Visitor
Jun 11, 2018 10:41 AM UTC

Why not a custom service? please do it with the custom service where you can do a thing Restart right on.

Translate