You need to sign in to do that
Don't have an account?
Misbah
Get User info Through SOQL
Hi
Is there any way to get current Logged in user information through Mobile SDK. I have some custom records which are assigned to users and we want to filter records based on logged in user.
I was doing a query
"Select Inspection_Name__C , Inspection_Date__c,Assigned_To__c from Inspecition__C where Assgined_To__c =: UserInfo.getUserId()
This query works fine in Apex class but on Mobile SDK it is giving error.
Is there any other way to even detect the logged in user login info so i could query the USER object to get more information about user.
The user ID is returned in the oAuth callback URI after login. It's available from the SFOauthCredentials. The call to retrieve it varies a bit by platform (iOS, Android, or Hybrid/JS).
All Answers
The user ID is returned in the oAuth callback URI after login. It's available from the SFOauthCredentials. The call to retrieve it varies a bit by platform (iOS, Android, or Hybrid/JS).
Hi TOm
I am using IOS SDK, I found SFOauthCredentials class and it has a USERID string function. can you please share the syntex how to initilize this class.
Hi Tom
Thanks for your help i played another trick in "SFAppDelegate" there is a method which is doing authentication , i added my code there to save the USERID in Preferences.
- (void)oauthCoordinatorDidAuthenticate:(SFOAuthCoordinator *)coordinator {
NSLog(@"oauthCoordinatorDidAuthenticate for userId: %@", coordinator.credentials.userId);
NSUserDefaults *pRef = [NSUserDefaultsstandardUserDefaults];
[pRef setValue:coordinator.credentials.userId forKey:@"UserID"];
[pRef synchronize];
[coordinator.view removeFromSuperview];
[self loggedIn];
}