Recently I enabled Partner Community for one of existing Accounts. As I noticed the new Role was created with the similar name of my Account - I assume this role can be used to share records with recently created Partner Account's employees (partner users)

Q: How to exactly determine Partner Community Role by Account Id? Is there any link between Partner Account and automatically created Role?

  • On Account, which related list are you referring to? – Raul Feb 13 '17 at 14:16

Found the reference to partner account in UserRole object. So in order to get automatically created Group for Partner Account you will need to do something like:

UserRole portalRole = [SELECT ParentRoleId FROM UserRole WHERE 
    PortalAccountId = :portalAccount.Id 
    LIMIT 1];
Group partnerPortalGroup = [SELECT Id, Name, 
    DeveloperName, RelatedId, Type, Email 
    FROM Group WHERE 
    RelatedId = :portalRole.Id];
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.