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
jaishrijaishri 

Case sharing record with user but access level is not working can anyone help me

List<CaseShare> csShareList = new List<CaseShare>();
for(case cs:trigger.new){
if(cs.Employee_Manager__c!=Null){
CaseShare csShare = new CaseShare();
// Give Read write access to that user for this particular case record.
csShare.CaseAccessLevel = 'Read';
// Assign case Id of case record.
csShare.CaseId = cs.id;
// Assign user id to grant read write access to this particular case record.
csShare.UserOrGroupId = cs.Employee_Manager__c;
csShare.RowCause='Manual';
csShareList.add( csShare );
}
}
insert csShareList;

 
Sai PraveenSai Praveen (Salesforce Developers) 
Hi JaiShri,

Are you trying to give read access to the Employee_Manager__c?

Thanks,
 
jaishrijaishri
Hi Sai,
      yes , i want to give the read access to this Employee_Manager__c.
Sai PraveenSai Praveen (Salesforce Developers) 
Hi,

Did you check if the record got created succesfully by quering it?

Thanks,
 
jaishrijaishri
Hi,
yes record is created successfully and sharing with other users also but accesslevel not working.
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Jai,

Does the profile has read access on the case object?

Thanks,