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
Team WorksTeam Works 

Compile Error: Field is not writeable for ,leadaccesslevel='read'

Hi All

 I keep getting the error message;

 Compile Error: Field is not writeable: LeadShare.LeadId at line 14 column 57

 

if(PartnerUsermap.ContainsKey(ld.createdById)){
                    partnershare = new LeadShare(LeadId=ld.id,UserOrGroupId=ld.createdById,leadaccesslevel='read');
                    leadshares.add(partnershare);
                  }

 

How to overcome this?Please suggest

 

Cheers

Best Answer chosen by Admin (Salesforce Developers) 
~Onkar~Onkar

Check your OWD sharing setting for LEAD seems is public read/write make is private or read only.

 

~Thanks,

Onkar Kumar

All Answers

~Onkar~Onkar

Can you post your code. Logic wise its fine and it work well.

 

~Onkar~Onkar

Check your OWD sharing setting for LEAD seems is public read/write make is private or read only.

 

~Thanks,

Onkar Kumar

This was selected as the best answer
Team WorksTeam Works

Thanks a lot Guys!!First time coding for sharing. ..