Skip to main content
1-Visitor
June 11, 2018
Solved

Unable to add new property programatically using service AddPropertyDefinition in Thingworx

  • June 11, 2018
  • 1 reply
  • 5144 views

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

Best answer by CarlesColl

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

1 reply

1-Visitor
June 11, 2018

Can you share your code?

amittal-31-VisitorAuthor
1-Visitor
June 11, 2018

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

1-Visitor
June 11, 2018

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