UserOrShareGroupId Field Displays Invalid GroupId for Share Table Queries
Last updated 2022-02-10 ·Reference W-1839458 ·Reported By 9 users
Summary
When running API queries on share tables (i.e. OpportunityShare), if a criteria-based sharing rule is in effect, the query displays an internal GroupId for the "UserOrGroupId" column. If this GroupId is pulled up in the UI, an Internal Server Error is returned.
Note: The fix for this Known Issue will display an "Insufficient Privileges" error instead of an Internal Server Error.
Repro
1. Create a criteria-based sharing rule on Opportunity (could be other object)
2. Create an Opportunity to satisfy rule created in Step #1
3. Run the following query using Data Loader or any other API tool:
SELECT Id,IsDeleted,LastModifiedById,LastModifiedDate,OpportunityAccessLevel,OpportunityId,RowCause,UserOrGroupId FROM OpportunityShare WHERE OpportunityId = <OppId from step 2>
4. Notice the UserOrGroupId value will throw an "Internal Server Error" if you try to access the Group via UI
Workaround
You can take the invalid UserOrGroupId returned in Step #3 of the Repro and run the following query:
SELECT UserOrGroupId FROM GroupMember WHERE GroupId = <UserOrGroupId from Step 3>
This will return the public GroupId, which can be accessed via the Salesforce UI.
Is it Fixed?
Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.