04-23-2013 01:44 PM - edited 04-23-2013 02:00 PM
I need to get the current user in SlxMobile (SLX 7.5.4). Actually, I need the First Name and Last Name, not the user name.
What I've tried so far:
In the SlxMobile OOB code, I found that it should be located in the localStorage:
I couldn't find that key in the localStorage. Also, I couldn't find the current user info in any of the localStoarge entries.
There's a service to get the user information, but it requires the current credentials:
var service = this.getService()
.setPassword(credentials.password || '');
var request = new Sage.SData.Client.SDataServiceOperationRequest(service)
I would have expected to not require the authentication after the user has authenticated in the log in page, but it does not work unless the user name and password are specified.
So, I need to get either the current user and password or the last name and first name at run time.
04-30-2013 10:17 AM
It looks like the Application in mobile 1.2 stores the user name from the feed returned by getCurrentUser:
You should be able access this infromation from the App global: App.context['user']
04-30-2013 11:29 AM
I'm currently using something similar:
var currentUserPrettyName = App.context.user.UserInfo.LastName + ", " + App.context.user.UserInfo.FirstName;