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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

AddPropertyDefinition on Thingworx display: Must Specify A Property Name

aziliotto
4-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?

2 REPLIES 2

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)

aziliotto
4-Participant
(To:jlittle)

Thank you Jeremy!

It was a syntax error, now it works properly!

Top Tags