[SalesForce] Is the OpportunityShare.RowCause available for changes through the API

According to the documentation on OpportunityShare about RowCause:

You can create a value for this field in API versions 32.0 and later
with the correct organization-wide sharing settings.

However, according to the fore.com developer guide (p. 187 as of the time of this post)

Apex Sharing reasons and apex managed sharing recalculation are only
available for custom objects.

I can't find a way to edit it via the UI and tried retrieving the picklist value from workbench but I got the error "Entity of type 'CustomObject' named 'OpportunityShare' cannot be found" which as I understand it is generally shown when an object is not modifiable…

Is it possible to add a value to this field, or is this a Salesforce documentation error?

Best Answer

Its just tricky wording..

Create - "When creating a record" - not create your own value

When creating an OpportunityShare or modifying an OpportunityShare where the RowCause is not set you can set the value to:

Valid values include:

  • Owner—User is the owner of the opportunity.
  • Manual—User or group has access because a user with “All” access manually shared the opportunity with the user or group.
  • Rule—User or group has access via an opportunity sharing rule.
  • ImplicitChild—User or group has access to the opportunity on the account associated with this opportunity.
  • Sales Team—User has access to the opportunity because the user is on the opportunity sales team for the opportunity. The OpportunityTeamMember object sets the access level. See OpportunityTeamMember for more information.

However you CANNOT create your own custom sharing reason values to set the row cause to

Hence the Apex Sharing reasons only being available for custom objects.

Also, OpportunityShare is only available to query via the UI if the OWD for the Opportunity are NOT set to public read / write. If the OWD is set to public read / write then you will get a query error

enter image description here

Related Topic