Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

setCustomUserField

Avatar

Level 3
I was trying to add the ability for a user to add a City name
to their profile in the CustomRoster example. I tried to set the
following cSession.userManager.setCustomUserField but I am sure I
called it wrong. I was setting the city name from a text input box
id=cityInput.



Then I was trying to display it in the mx:list by adding to
the line - return uDesc.displayName+", "+role+",
"+uDesc.customFields;



What is the correct procedure to set and then call?



Thanks
1 Accepted Solution

Avatar

Correct answer by
Level 10
And here's the event class that goes with it.

View solution in original post

6 Replies

Avatar

Level 10
Hi,



For adding a new field, you need to first register the custom
field by calling cSession.userManager.registerCustomUserField API
and then you should call setCustomUserField to set the value of
that field. Once this is done, you can then get the value from
uDesc.customFields[myfieldName]



Hope this helps.



Thanks

Hironmay Basu

Avatar

Level 3
thanks, but I cannot still get the syntax right. I am trying
to test it by changing the CustomRoster example slightly so when
the user role changes the new field is registered and set. I then
call by using return uDesc.displayName+", "+role+",
"+uDesc.customFields['testfield']; Could you please help with the
correct syntax.



Sorry for my ignorance.



Avatar

Level 10


Hi there,



Unfortunately, you've stumbled into an area of code that
isn't supported yet. This is our bad - we should have removed this
before this release, since it was pretty buggy, and we ran out of
time to get it done properly for public beta. For a little
guidance, if it's marked @private, it's probably not ready for
prime-time :). Sorry for the confusion - We'll definitely get this
fixed for the next beta drop.



So, back to the problem at hand, what I'd suggest for now is
to create a separate shared model, which is indexed by userID, and
is set to userDependentItems=true, meaning that details are
retracted as users leave the room. I'll post an example in a
minute.



nigel

Avatar

Level 10
Here's an example model class that can work for this purpose
:

Avatar

Correct answer by
Level 10
And here's the event class that goes with it.