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
pooja biswaspooja biswas 

account share object

Hi
Please help me clear the following concept.

a) Trying to understand what is account share and opportunity share   sobjects.
How they related to account and opportuntity
In what business case scenario do we use them
what is RowCause field? How does it affect Master-detail relationship?

b) How to resolve  " Field is not writeable: " error in apex?
  
Thanks
Pooja 
Best Answer chosen by pooja biswas
Akhil AnilAkhil Anil
It's incorrect to say that rowcasue field is non editable.

This field specifies the reason that this sharing entry exists. You can only write to this field when its value is either omitted or set to Manual (default). You can create a value for this field in API versions 32.0 and later with the correct organization-wide sharing settings.
Valid values include:
Manual—The User or Group has access because a User with “All” access manually shared the Account with the user or group.
  • ImplicitParent—The User or Group has access because they’re the owner of or have sharing access to records related to the account, such as opportunities, cases, contacts, contracts, or orders.
  • Owner—The User is the owner of the Account
  • Team—The User or Group has team access (is an AccountTeamMember).
  • Rule—The User or Group has access via an Account sharing rule.

All Answers

Akhil AnilAkhil Anil
Hi Pooja,

Account Share and Opportunity Share are basically objects that a developer can use in Apex to share the records with users based on certain conditions. It's solely used for sharing and stores data related to which record is shared with whom and what access level had been provided to them. You can read more about Apex managed sharing in the below link nand that will help you understand this concept better.

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

Kindly mark it as an answer if that resolves youe query !
pooja biswaspooja biswas
Hi 
if w have to share record based on certain conditions with other users then we can use criteria based sharing rules then why need for account share sobject?
also I can use create a report for account object, then export the data into excel then why need of account share object?

Thanks
Pooja
Akhil AnilAkhil Anil
Hi Pooja,

Apex managed usually comes into picture when you have a very complex sharing model which CANNOT be handled by criteria based sharing or ownership based sharing.
pooja biswaspooja biswas
Hi
cud u pls tell me what significance of rowcause field and why it is always non editable?
also what values the rowcause field can have?

 
Akhil AnilAkhil Anil
It's incorrect to say that rowcasue field is non editable.

This field specifies the reason that this sharing entry exists. You can only write to this field when its value is either omitted or set to Manual (default). You can create a value for this field in API versions 32.0 and later with the correct organization-wide sharing settings.
Valid values include:
Manual—The User or Group has access because a User with “All” access manually shared the Account with the user or group.
  • ImplicitParent—The User or Group has access because they’re the owner of or have sharing access to records related to the account, such as opportunities, cases, contacts, contracts, or orders.
  • Owner—The User is the owner of the Account
  • Team—The User or Group has team access (is an AccountTeamMember).
  • Rule—The User or Group has access via an Account sharing rule.
This was selected as the best answer