Cannot get ThingShape object which I want to modify programmatically
In the below script thingShape is undefined. I am using ThingWorx 8.1
Don't we have a way to retrieve a ThingShape and modify it or retrieve its property definitions programmatically once we created it with this code:
Resources["EntityServices"].CreateThingShape(params);
var params = {
name: "MyThingShape" /* STRING */,
description: undefined /* STRING */,
tags: undefined /* TAGS */
};
// no return
Resources["EntityServices"].CreateThingShape(params);
var thingShape = ThingShapes["MyThingShape"]
I would like to created ThingShapes properties as remote ones and give it Remote Prop Name.
The only way I could find if a ThingShape exists is by using this code:
var params = {
maxItems: undefined /* NUMBER */,
nameMask: thingShape /* STRING */,
type: "ThingShape" /* STRING */,
tags: undefined /* TAGS */
};
// result: INFOTABLE dataShape: RootEntityList
var matchingEntries = Resources["EntityServices"].GetEntityList(params);
... but this returns RootEntityList, wich is a read only object I cannot act on.
This article mentioned ThingShapes[ThingShapeName] as a way to retrieve the ThingShape but as I mentioned it doesn't work.
How to change specific ThingShape propertydefinition
Also I noticed an error in Snippents for Entities filtered to ThingShape.
GetPropertyDefinitions snippet seems to be the same for both types pointing to DataShapes object holding both ThingShape and DataShape. Correct me please if I don't understand this properly.
Thanks,
Rad


