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
ppatppat 

OpportunityAccessLevel .. Read only through API ?

I am trying to add Opportunity Sales Team through Apex. Trigger works fine except "OpportunityAccessLevel" field.

Here is the error : Field is not writeable: OpportunityAccessLevel

If I insert the record without specifying the OpportunityAccessLevel = 'Read/Write'  , default values is getting assigned as OpportunityAccessLevel = 'Read Only'.  I need to assign value OpportunityAccessLevel = 'Read/Write' while adding sales team member.

Any workaround ?

Thanks

Pramod

ppatppat
Figured it out. Just for the future reference ,

When you add record into OpportunitySalesTeam , salesforce inserts corresponding record into "OpportunityShare" table with "OpportunityAccessLevel"='Read'

Add code for OpportunityShare table to update opportunityAccessLevel with value "Edit"

Hope this helps.
Nerv123Nerv123

Pramod,

 

I have a similar requirement, and need to make a trigger for the Opportunity object, so that the sales reps can add themselves/others to the sales team. They are not the owners of the opportunity. Please share your code for the trigger, if possible.

 

Thanks!!

ppatppat
Nerv123 ,

PM'd the logic.

-Pramod
Tara_AgrawalTara_Agrawal
Hi Pramod,

I'm getting a  FIELD_INTEGRITY_EXCEPTION for : RowCause (cannot update sharing row with this cause) when I'm trying to update the access field of OpportunityShare table with value "Edit". Any input to resolve this would be much appreciated.

Thanks,
Tara
Tara_AgrawalTara_Agrawal
Figured it out, thanks.

Tara


Salesforce_user007Salesforce_user007

Hi Tara,

 

Can you tell me what was the solution for your above comments?? Even I am getting the same Error.

 

"I'm getting a  FIELD_INTEGRITY_EXCEPTION for : RowCause (cannot update sharing row with this cause) when I'm trying to update the access field of OpportunityShare table with value "Edit". "

 

 

Thanks in Advance.