0

I am trying to create entity subscription for a Portal User(Isportalenabled = true) to an opportunity, but I'm ending up with the following error on insert of entity subscription.

11:40:06:128 USER_DEBUG [97]|DEBUG|Exception***System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, This person’s information is private because they’re not a member of the community.: []

Here is my code

    community = [ SELECT Id FROM Network WHERE Name = 'Deal Concierge'];
               if(!subscriberToEntity.containsKey(usr.Id)){
                        EntitySubscription es = new EntitySubscription();
                        es.NetworkId = community.Id; 
                        es.SubscriberId = user.Id;
                        es.ParentId = opportunityId;
                        esList.add(es);
                    }
                }
                if(esList.Size() > 0){
                    insert esList;
                }
0

The User's Profile is invisible to community, So I added Profile to community management > Administration > Members.

https://help.salesforce.com/articleView?id=networks_customize_members.htm&type=0

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.