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
rohit.mehtarohit.mehta 

OpportunityTeamMember

Hello,

 

I have a requirement where on convert of a lead I want to add the original owner of the lead on the Opportunity Sales Team.

 

I am able to create a OpportunityTeamMember record but I am not able to set the access level. Compilation throws an error - "Field is not writeable"

 

Any ideas how can I set the access level?

 

 

//This works

OpportunityTeamMember tm = new OpportunityTeamMember(UserId = myId, OpportunityId = l.ConvertedOpportunityId, TeamMemberRole = role );

//this does not work
OpportunityTeamMember tm = new OpportunityTeamMember(UserId = myId, OpportunityId = l.ConvertedOpportunityId, TeamMemberRole = role, OpportunityAccessLevel = 'Read');

//throws error - field is not writeable

 

Thanks,

Rohit

 

CarcajouCarcajou

Hi Rohit, 

 

The OpportunityAccessLevel field is not writable. So you will never be able to set it. But you can still create the record without setting this field.

Then if you wnat to take care about the rights, you need to create a record in the OpportunityShare Object. 

 

Hope this helps. 

Catherin.