+ Start a Discussion
asapjimasapjim 

How to determine if the current user is a Partner user?

Hi, I am trying to detect if the current user is a Partner user.  When I look at the API/WSDL, I see a field on the User object named IsPartner.  But, when I add the IsPartner field to a query I receive the following exception:

 

Error: No such column 'IsPartner' on entity 'User'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.

 

Here's the query I am attempting to execute:

User theUser = [Select u.City, u.CompanyName, u.ContactId, u.Country, u.Email, u.FirstName, u.IsPartner, u.LastName, u.MobilePhone,u.PostalCode, u.State, u.Street from User u Where u.iD=:UserInfo.getUserId()   Limit 1];

 

What's the best way to determine if the current user is a Partner user?

 

Thanks!

 

     

asapjimasapjim

Correction, I do NOT see the IsPartner field in the API, I see it in the UI.  I do see an IsPartner field in Apex Explorer.

Gunners_23Gunners_23

Please Use "IsPortalEnabled" on User object. If you know user's Account record in that case you can use "isPartner"

 

Use the below SOQL Query to fetch the details

 

SELECT IsActive,IsPortalEnabled,LastName FROM User