function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
manicmanic 

CaseShare object and Partner portal

Hi all.

 

Because Cases have private Org wide defaults and once created via Partner Portal get assigned to different users/queues we've created a manual sharing rule by using Apex utlizing CaseShare object. There is an exception being generated while doing insert caseShareList. Error says: There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Apex trigger AllCaseTriggers caused an unexpected exception, contact your administrator: AllCaseTriggers: execution of AfterUpdate caused by: System.DmlException: Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []: Class.CaseSharing.ShareCaseManually: line 19, column 9".

 

In api it says "Customer Portal users cannot access this object.". What does that mean exactly? That SFDC prevents insertion of CaseShare records even when doing it inside a class with no sharing specified?

 

Also, when I disable the insert shareCaseListLine, user in partner portal can see the case they have just created although org wide defaults are private and case has been reassigned to a queue via assignment rules?! Users accessing SFDC directly lose visibility of the case once saved unless sharing via code is enabled.

 

Thank you for your help,

 

Marko

nashnessnashness

Specifying without sharing doesn't seem to help in my case as well. To solve it, I had to make my method run as Future method to ensure the code runs under a system user context.