I am writing a trigger that looks up to a parent (Lookup) Opportunity from a custom object, and am coming across an interesting problem. I have a sharing rule set up on the Opportunity to grant Edit access to a group based on a checkbox being set. However, when I query for the OpportunityShares against that Opportunity, the UserOrGroupId for that rule is an ID that does not match. I can't tell if there is some sort of wrapper around my group regarding the sharing rule, and due to that I can't complete my corresponding trigger that dynamically propagates the Opportunity security to my custom object (which can't be a Master-Detail for other reasons).
For comparison sake:
Group ID: 00GD0000001Afjh
UserOrGroupID from query: 00GD0000001AfLxMAK