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
Neel88Neel88 

Sharing Opportunities, contacts, accounts in Partner Community using Apex

My Opportunities have related contacts via lookup. The opp is owned by neither of them or could be owned by one of them. I want to be able to share the records with both contacts as users  in partner community. I found https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm for Creating User Managed Sharing Using Apex. I tried to use it however not being conversant with apex programming I am not able to resolve the test fail. I am wondering how to share the records using apex or otherwise. Please advice
NagaNaga (Salesforce Developers) 
Hi Neel88,

Please check the links below for more information on this

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_bulk_sharing_creating_with_apex.htm

http://salesforce.stackexchange.com/questions/20894/sharing-access-to-partner-community-users-based-on-record-owner

Best Regards
Naga Kiran
Neel88Neel88
I am trying the first solution however I get this an error as attachedUser-added image