I am trying to deploy some Apex-based sharing. Everything works fine in sandbox and code is 100% covered. I have a set of contacts (with a related User field) and a set of Project Task records (a Private object). Both the Contact records and the Project Task records have a matching Department picklist. I have triggers on both objects executing @future methods to do the following:
- Share the Project Task with the related users of all Contact records with a matching department after Project Task insert (or update on Department change) if they haven't been shared the record already
- Share all Project Tasks with the related user when a new Contact is inserted that match that Contact's department.
Everything works perfectly in sandbox, but I get this error upon deployment for both methods:
sObject type 'pse__Project_Task__Share' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.
I'm getting the error specifically when I first query the Share object to see what records exist already:
for(pse__Project_Task__Share pts : [SELECT ParentId, UserOrGroupId
FROM pse__Project_Task__Share
WHERE ParentId IN : taskMap.keyset()])