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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

Properties not updating after programmatically creating Thing

ptc-6682754
1-Newbie

Properties not updating after programmatically creating Thing

I'm trying to automatically create a Thing using either the .NET SDK or a server-side script so that we don't have to manually create Things using Composer.

I'm calling

CreateThing()

on EntityServices, then

EnableThing(), RestartThing()

, and

SetIdentifier()

on the Thing I just created. The Thing's Connectable property

isConnected

is being set to true, and I can successfully call generic services on the Thing, but other properties won't update and I can't call custom services. This also happens if I create a Thing in Composer without an identifier, then call

SetIdentifier()

. If I attempt to set the value of a property or call a custom service in Composer, I get the exception "The given key was not present in the dictionary". Restarting the SDK client doesn't fix it.

If I create the Thing in Composer (defining a Name, Thing Template, and Identifier before clicking Save), or I edit a programmatically created thing in Composer and save without making changes, everything works. The issues only seem to happen if I manually set the identifier of a Thing that was created without an identifier.

What additional steps are needed to make a programmatically created Thing's custom properties and services work properly?

UPDATE:

This issue was fixed by updating the server to 5.3 SP1. No client updates were needed. Thanks guys!

5 REPLIES 5

Try doing a RestartThing after SetIdentifier.

Sorry, forgot to mention that after calling

SetIdentifier()

, I did try calling

RestartThing()

, both with and without calling

DisableThing()

and

EnableThing()

first. Doing this caused the Thing to disconnect (

isConnected

became false), so I restarted the client to reconnect the Thing and still have the same problems.



I've got the same problem here. What I found out, is that when you have automaticly created a remote thing, activate it, add the identifier and restart it, the thing will not connect. But when you open the thing via the composer and save it again it connects itself. My idea would be to trigger the "Save" operation. Is there a possibility to do this via java script?



Looks like the Combined[...].js file in the server's Composer folder is responsible for performing the save operation, more specifically the _saveAndContinue function. So far I haven't been able to replicate it.



Updating the Thingworx server to 5.3 SP1 fixed it. Properties now update properly when programmatically creating a Thing and using SetIdentifier().

Top Tags