Showing results for 
Search instead for 
Do you mean 
Community Home Request Access Read Blogs Share Your Ideas Search Community View My Settings
Reply
Copper Contributor
Posts: 56
Registered: ‎02-22-2012

SLXMobile: get Current User or current credentials

[ Edited ]

Hi,

 

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:

 

File: SlxMobile\source\products\argos-saleslogix\src\Application.js

Function: handleAuthentication

Code:

window.localStorage.getItem('credentials')

 

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:

 

File: SlxMobile\source\products\argos-saleslogix\src\Application.js

Function: authenticateUser

Code:

        var service = this.getService()
            .setUserName(credentials.username)
            .setPassword(credentials.password || '');
        var request = new Sage.SData.Client.SDataServiceOperationRequest(service)
            .setContractName('system')
            .setOperationName('getCurrentUser');

 

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.

Any ideas?

 

Regards,

 

     Marcos

 

Employee
Posts: 51
Registered: ‎12-16-2011

Re: SLXMobile: get Current User or current credentials

It looks like the Application in mobile 1.2 stores the user name from the feed returned by getCurrentUser:

 

https://github.com/SageSalesLogix/argos-saleslogix/blob/1.2/src/Application.js#L74

 

You should be able access this infromation from the App global: App.context['user']

 

Highlighted
Copper Contributor
Posts: 56
Registered: ‎02-22-2012

Re: SLXMobile: get Current User or current credentials

Thank you.

I'm currently using something similar:

 

var currentUserPrettyName = App.context.user.UserInfo.LastName + ", " + App.context.user.UserInfo.FirstName;

 

Regards,

 

      Marcos