3 Replies Latest reply on Jul 15, 2015 4:43 AM by ashleyg RSS
    ashleyg Apprentice

    Assigning Extra User Extension Properties

    Hi all

     

    I am attempting to assign properties to the User Extensions, I can get the default extensions to be assigned in a script fine. However, when adding extra User Extensions to the UserExtensions ThingShape I cannot assign these in a script.

     

    The following code is what I am using to attempt to do this. The script executes but only the default User Extensions are assigned when I execute the service.

     

    var params = {

      infoTableName : "InfoTable",

      dataShapeName : "Atlas.user.DataShape"

    };

     

     

    // CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(Atlas.user.DataShape)

    var userInfoTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

     

     

    var values = new Object();

     

     

    values.company = company;

    values.emailAddress = Email;

    values.firstName = firstName;

    values.lastName = secondName;

    values.language = Language;

    values.mobilePhone = Mobile;

    values.continent = continent;

    values.country = country;

    values.jobTitle = jobTitle;

    values.timeZone = timeZone;

    values.serialNumberOfCompressor = serialNumberOfCompressor;

    values.site = site;

    values.UnitsOfMeasurement = UnitsOfMeasurement;

    values.regionalCentre = regionalCentre;

     

     

    userInfoTable.AddRow(values);

     

     

    var params = {

      values: userInfoTable // INFOTABLE

    };

     

     

    // no return

    Users[userName].SetPropertyValues(params);

     

    Any feedback would be greatly appreciated.

     

    Many thanks

     

    Ash

      • Re: Assigning Extra User Extension Properties
        paic Collaborator

        You can just use Users[UserName].UserExtensionName = NewValue;

          • Re: Assigning Extra User Extension Properties
            ashleyg Apprentice

            Thank you for your suggestion Pai.

            After attempting that, the "language" of the user has now successfully changed but none of the other custom User Extensions are being assigned, only firstName, lastName, mobilePhone and emailAddress as before.

             

            This is what my code looks like now (in replace of the SetPropertyValues() function and values object):

             

                Users[userName].company = company;

                Users[userName].emailAddress = Email;

                Users[userName].firstName = firstName;

                Users[userName].lastName = secondName;

                Users[userName].language = Language;

                Users[userName].mobilePhone = Mobile;

                Users[userName].continent = continent;

                Users[userName].country = country;

                Users[userName].jobTitle = jobTitle;

                Users[userName].timeZone = timeZone;

                Users[userName].serialNumberOfCompressor = serialNumberOfCompressor;

                Users[userName].UnitsOfMeasurement = UnitsOfMeasurement;

                Users[userName].regionalCentre = regionalCentre;

            • Re: Assigning Extra User Extension Properties
              ashleyg Apprentice

              Never mind I've just found the solution. The new User Extensions I had added to the UserExtensions ThingShape were not persistent, I didn't think that would matter but after doing that my code now fully works.

               

              Thanks for your help.

               

              Ash