2 Replies Latest reply on May 30, 2017 8:11 AM by albertoz RSS
    albertoz Explorer

    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?