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

AddPropertyDefinition on Thingworx display: Must Specify A Property Name

Highlighted
Participant

AddPropertyDefinition on Thingworx display: Must Specify A Property Name

Hi, i have an issue adding dynamically properties to a remote template create by snippet.

I get an error reporting this:

JavaException: com.thingworx.common.exceptions.InvalidRequestException: Must Specify A Property Name

this is the code:

//template creation

var paramsRemoteThing = {

    name: "MyTemplate",

    description: "This is the description", // STRING

    thingTemplateName: 'RemoteThing',

    tags: 'MyParent:Template'

};

Resources["EntityServices"].CreateThingTemplate(paramsRemoteThing);

//add a remote property

var paramsIns = {

        defaultValue: undefined , // STRING

        description: undefined , // STRING

        readOnly: false,  // BOOLEAN

        type: "STRING",  // BASETYPENAME

        remote: false , // BOOLEAN

        remotePropertyName: "ThisIsMyNamedProperty" , // STRING

        timeout: undefined , // INTEGER

        pushType: "VALUE" , // STRING

        dataChangeThreshold: undefined,  // NUMBER

        logged: false, // BOOLEAN

        name: "variabile" , // STRING

        pushThreshold: undefined , // NUMBER

        dataChangeType: "VALUE" , // STRING

        category: "remote" , // STRING

        persistent: true, // BOOLEAN

        dataShape: undefined // DATASHAPENAME

    };

    // try to add property

    try{

         ThingTemplates[nomeTemplate].AddPropertyDefinition(paramsIns );

    }catch(e){

         logger.error("ERROR adding proeprty:  "+e)

    }

What am i missing ? after creating is necessary to bind remote property?

Tags (1)
2 REPLIES 2

Re: AddPropertyDefinition on Thingworx display: Must Specify A Property Name

You may want to have a look at KCS 237302 which goes through dynamically mapping properties on a Remote Thing.  There is mention of code on the Edge device, though ultimately it is simply triggering the Service defined on the Remote Thing Template to map the properties.

This will only work if you've defined your remote properties on your edge device.  (This example was specifically used with the Java Edge SDK when it was written)

Re: AddPropertyDefinition on Thingworx display: Must Specify A Property Name

Thank you Jeremy!

It was a syntax error, now it works properly!