Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
Solved! Go to Solution.
Well, then you either created a GhostThing (put logging into the catch clause and check the logs) or you didn't start the Thing.
After creating it successfully, you have to run
Things["TestThing"].EnableThing();
Things["TestThing"].RestartThing();
Hi, @Pratik_Aswale Can you explain your use case and look at the below article for creating entities programmatically?
Thanks for your replay.
I want to create a new thing in a mashup. like suppose I have a label widget in mashup, so when I enter a new thing name manually in label widget and click on button widget then my entered new thing will generate and show in thingworx composer.
Is this possible or does have any thingworx service inbuilt for this?
You can't enter a name using a label widget, it would have to be a TextField widget or similar.
TextField has a "Changed" event which you can bind to the execution of the service. You would bind the Text properties also as input to the service. The service will user the CreateThing service to create the thing. You can find examples how to use CreateThing properly here: https://support.ptc.com/help/thingworx/platform/r9.5/en/index.html#page/ThingWorx/Help/Best_Practices_for_Developing_Applications/ExampleGhostEntities.html
Hello @Rocko
Thanks for your input...
I read that article but in this they talking about ghost entities which is only temporary not show in composer, after refreshing browser it will disappear and also even not stored or display in database.
My usecase is I want to create thing in Thingworx composer by using mashup and also using text field widget, just like our regular thing which have properties, services, subscription etc.
The linked article contains explicit code examples on how to properly use CreateThing service to create things programmatically which what is what you want to do. I gave clear instructions, on what widget to use, how to bind it to a service and the code sample in the articles tell you what the service should look like.
@Rocko Thanks for replay
Yes, As you said I did it and thing also generating. but now the problem is that how can I use created thing. because after creating Thing I m trying to search that thing but its not appear in composer.
Well, then you either created a GhostThing (put logging into the catch clause and check the logs) or you didn't start the Thing.
After creating it successfully, you have to run
Things["TestThing"].EnableThing();
Things["TestThing"].RestartThing();