+ Start a Discussion
shaker shaikhshaker shaikh 

trigger for sharing record and error - Field is not writeable: CaseShare.CaseAccessLevel

the below written trigger showing error - Field is not writeable: CaseShare.CaseAccessLevel

trigger case_share on Case (After insert) {
    List<caseShare> csshare = new List<caseShare>();
    user ur = [SELECT id from user where Alias = 'ujosh'];
    for(Case c: Trigger.new){
        if(c.Priority=='High' && c.Origin=='Email'){
         caseShare cs = new caseShare();
         cs.caseid = c.id;
         cs.caseAccessLevel = 'Edit';
         cs.UserOrGroupId = ur.id;
         cs.RowCause = 'Manual';

unable to understand where i am making error plz help ...
Amit Chaudhary 8Amit Chaudhary 8
Please check below post for similer issue
1) http://blog.jeffdouglas.com/2011/03/17/opportunityaccesslevel-not-writable/

I've seen the CaseAccessLevel field cannot be inserted, but it can be changed with an update once the record is already inserted

Let us know if this will help you
shaker shaikhshaker shaikh
Thank you Amit,,
i have gone through the link you provided, still i could't get can you please provide more detial on this