Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hi,
I am trying to create a Thing and assigning a value to the Properties that are inherited from the Thing Template, below is the code.
Resources["EntityServices"].CreateThing({
name: "testfty" /* STRING */,
thingTemplateName: "testfty.TT.testfty" /* THINGTEMPLATENAME */,
projectName: "comP" /* PROJECTNAME */,
});
Things["testfty"].Enable();
Things["testfty"].Restart();
Things["testfty"].Property1= 32;
Things["testfty"].Property2= 56;
But I am getting the following error:
Error executing service addSensor. Message :: TypeError: Cannot find function Enable in object com.thingworx.things.ConfiguredThing@a3e81bb. - See Script Error Log for more details.
Thanks,
Solved! Go to Solution.
Please use EnableThing/RestartThing
Things["testfty"].Enable(); --> Things["testfty"].EnableThing();
Things["testfty"].Restart(); --> Things["testfty"].RestartThing();
Please use EnableThing/RestartThing
Things["testfty"].Enable(); --> Things["testfty"].EnableThing();
Things["testfty"].Restart(); --> Things["testfty"].RestartThing();
And, as a reminder for others in case of similar situations, all the Services available for a Thing are available in the Services section, so you can verify it a service with that name exists there, OR in the service editor you can select as a reference another entity, and at this point you will also see all its services.