Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Get calling UserName by UserID

Avatar

Level 3

I want to do this:


        private function getUserName(sUserID:String):String
        {
            ?
        }

I do this:


            collectionNode = new CollectionNode();
            collectionNode.sharedID = "dataObject";
            collectionNode.connectSession = _cSession;
            collectionNode.subscribe();
            collectionNode.addEventListener(CollectionNodeEvent.ITEM_RECEIVE, onItemReceive);

          ...

and need the UserName in onItemReceive

henry

3 Replies

Avatar

Former Community Member

Hi Henry,

Not sure I understand what you're getting at here. Generally,

_cSession.userManager.getUserDescriptor(sUserID).displayName will give you

what you want, provided the session is synched up.

hope that helps,

nigel

Avatar

Level 3

OK


        private function getUserName(sUserID:String):String
        {
            if (_cSession.isSynchronized) {
                return _cSession.userManager.getUserDescriptor(sUserID).displayName;
            } else {
                return "";
            }
        }

Or can force to sync? I would hate to return "".

Or is the CollectionNodeEvent.ITEM_RECEIVE event proc always called in synchronized state?

Henry

Avatar

Former Community Member

Hi,

Assuming your user is connected and in the room, the session's in sync, so

you're right, you'll always be in sync during ITEM_RECEIVE.

nigel