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
Damien_Damien_ 

With sharing causing errors when Owner changes from workflow

Insert failed. First exception on row 0; first error: INSUFFICIENT_ACCESS_ON_CROSS_REFERENCE_ENTITY, insufficient access rights on cross-reference id: []

 

This happens when I use code to create an object, then a workflow changes the owner for a normal user, and then I create another object that uses this Id.

 

Does anyone have a way to get around this without removing the 'with sharing' from my class?