0

I would like to share OpportunityTeamMember records via the Apex Sharing feature. I could not run the following code, though:

<OpportunityTeamMemberShare otms = new OpportunityTeamMemberShare(
    ParentId = '0065r000004vwMCAAY',
    UserOrGroupId = '0055r000002p6K2AAI',
    AccessLevel = 'Edit'
);
insert otms;

Got this error:

Error: Invalid type: OpportunityTeamMemberShare

Tried OpportunityTeamMember__Share, but with no success as well.

Looks like OTMs are not possible to share via Apex. Are there any known workarounds to this issue? Maybe I should try with another object, as Opportunity Teams are a standard feature with a little more advanced logic underneath? Sadly, I couldn't find any useful resources in SF docs about that.

2
  • Would not adding someone to Opportunity Team member give them access to opportunity. It has access level field as well. Why do you need to insert in share object?
    – RedDevil
    Apr 14, 2022 at 8:54
  • @RedDevil To Opportunity - yes. However, only owners and users above in the hierarchy can modify Opp Splits and Team Members of the given Opp. That's unfortunate as for our case it must be the whole team and that's why we are looking for workarounds that could enable other users to modify splits and other members as well. Apr 14, 2022 at 9:37

1 Answer 1

0

It looks like it's currently not possible to change this behaviour, I asked SF support about that. Here's their answer:

I understand that you need help with User loose access to editing Opportunity Splits and Opportunity Teams after changing the owner

The opportunity owner or above the owner in the role hierarchy, can add and adjust splits on an opportunity.

Sell as a Team and Split the Credit https://trailhead.salesforce.com/en/content/learn/modules/leads_opportunities_lightning_experience/sell-as-a-team-and-split-the-credit

[...]

I apologize that you have a limited access to the features you needed. But what i could suggest is reach out to your Account Executive [...]

Some additional thoughts: What I would possibly think of, is that in case this feature is crucial for one's implementation, a custom development could help in this case. The Opportunity Team data model is, of course, accessible from the admin's perspective and with the use of some custom sharing model (based on an additional object maybe?), together with a custom LWC component replacing the standard one, access could be expanded.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .