+ Start a Discussion
Eran VizelEran Vizel 

Account Contact Role not Accessible in Apex by Customer Community Users

I wrote a trigger that runs upon creation of a case. The trigger goes to the parent account, fetches any Account Contact Roles that are named as "Case Auto CC", and creates coresponding Case Contact Roles.
This runs fine by any internal user or by integration user, but when a Customer Community user tries to open a case, this piece fails with the exception of : System.QueryException: No such column 'AccountId' on entity 'AccountContactRole'.

map<Id, Account> map_Accounts = new map<Id, Account>([SELECT Id,
                                                                         (Select ContactId, Role
                                                                          From AccountContactRoles
                                                                          Where Role = 'Case Auto CC')
                                                                  FROM Account
                                                                  WHERE Id in :accountIds]);

I suspect it has to do with the portal user permissions. However I've given the portal profiles both Read and Edit permissions for account object (Since I believe AccountContactRole inherits its permissions from Account), and opened account as public read/write in the OWD, still this exceptions presists. 

Any idea why?

Many thanks,