You need to sign in to do that
Don't have an account?
setting AccountSharing on Account fires Exception INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY
Testing a trigger that establishes account sharing rules via Apex.
Trigger logic is setting the AccountShare object values as follows:
AccountShare processorSharingRule = new AccountShare();
processorSharingRule.AccountId = acct.Id;
processorSharingRule.OpportunityAccessLevel = 'None';
processorSharingRule.CaseAccessLevel = 'Edit';
processorSharingRule.AccountAccessLevel = 'Edit';
processorSharingRule.UserOrGroupId = pdr_u.Id;
acctSharingRules.add(processorSharingRule);
Exception fires when this code executes:
if (acctSharingRules.size() > 0) {
upsert acctSharingRules;
}
I have output the values of the acct.Id and pdr_u.Id and both contain valid values. So it looks to be a security
setup problem.
Account is setup: Private with Grant using Hierarchies
Opportunity is setup: Private with Grant using Hierarchies
Case is setup: Private with Grant using Hierarchies
2 roles being used:
- PDR/DSR setup to control which users can access/manage the above entities. They are set Read Only.
Any idea what I might be missing here that is causing the exception??