2

When i try to query for AccountContactRole for the Contact who is a Community member. I'm getting an exception. It says that AccountContactRole Not supported for Communities.

10:43:05.203 (203908580)|EXCEPTION_THROWN|[71]|System.QueryException: sObject type 'AccountContactRole' is not supported.
10:43:05.204 (204034547)|USER_DEBUG|[90]|DEBUG|Exception Occured
10:43:05.204 (204053966)|SYSTEM_MODE_EXIT|false

This is the Query i want to fetch records for

for(AccountContactRole acr : [SELECT AccountId,Role FROM AccountContactRole where ContactId =: c.Id AND ((Role =: 'Member Approver') OR (Role =: 'Member Requestor'))] ){
                    accIds.add(acr.AccountId);
                    rolesMap.put(acr.AccountId,acr.Role);
                    system.debug('**ACR ACCOUNTS'+accIds);
                }

Please let me know if there is a workaround on this.

1 Answer 1

2

If you look in the Object Reference under AccountContactRole, you'll find the following note:

Special Access Rules

Customer Portal users can't access this object.

First, let me say that this makes sense to me. In a Customer Community, you have Users related to Accounts, not Contacts. Further, in a Customer Community, a User's contact role wouldn't be appropriate information for a Customer User to view with respect to their Account. That information is for internal use only. This information is available in a Partner Community, because Account Contact Roles is information that Partners need access to in managing their Accounts and Contacts. In a Customer Community, those Users don't manage Account Contact Roles, internal Users manage who's in what role in an Account. If that's not the way it's being done in your org, then you're using it in a different way than it was intended.

That having been said, the only way I know of that you could access this information from a Customer Community, would be to create a "mirror object" of Account Contact Role then use a trigger to keep it in sync. You could then expose the custom object to the community. If you want to want to make changes to it within the Community, you'd need two triggers, a 2nd trigger would be required to sync changes back in the other direction from the custom object to Account Contact Role. You'd want to be very careful with respect to permissions if you were going to allow changes to be made from the Community side of things.

2
  • Thanks :) I had to create a custom object and update standard object via a trigger.
    – AjaySFDC
    Commented Sep 16, 2015 at 19:18
  • Good to hear you got it sorted. If this post led you to solving your issue, please help the rest of the community by marking it as having answered your question.
    – crmprogdev
    Commented Sep 16, 2015 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .