Skip to main content
1-Visitor
July 13, 2015
Solved

Assigning Extra User Extension Properties

  • July 13, 2015
  • 3 replies
  • 2443 views

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

    Best answer by paic

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

    3 replies

    paic1-VisitorAnswer
    1-Visitor
    July 15, 2015

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

    ashleyg1-VisitorAuthor
    1-Visitor
    July 15, 2015

    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;