+ 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.