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
grigri9grigri9 

Possible Apex Bug: Can't clone Sharing records

I'm getting an Internal System Error when I try and clone an AccountShare record. Is this expected behaviour?

 

 

AccountShare share = new AccountShare();
Sobject temp = share.clone();

//Internal System Error: 484031483-1083 (1704813194)

 

 

Pradeep_NavatarPradeep_Navatar

The share objects can be volatile, in other words, changing the sharing model may make them disappear.  Salesforce will prevent you from changing the sharing model in these circumstances, your code might break as a result of a change to the sharing model.  The solution is to avoid making any direct references to these objects, for example, if you are creating a list from a query on a sharing object, make sure that the type in the list is of type SObject, instead of the sharing type.

 

Hope this helps.