i have to select Only Users which are community partner Users.How to select them ??what will be the SOQL query for selecting partner Users ?? which field in User profile will tell whether the user is community partner User or not ??
2 Answers
You can select by Profile name. Check which profile your community users have, and use that in your query.
[SELECT Id FROM User WHERE Profile.Name = 'Partner Community']
Partner portal users also have access to Community So, it is better to filter a query by Community license:
This will return all users who have a profile with license of community.
List <User> communityUsers = [SELECT id, Name FROM User WHERE Profile.UserLicense.Name='Partner Community' OR Profile.UserLicense.Name='Customer Community'];