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
SandySandy 

Hi, I am trying to implement this trigger but it gives me error

trigger CompleteResolutionTimeMilestone on Case (after update) {
  if (UserInfo.getUserType() == 'Standard'){
     DateTime completionDate = System.now();
     List<Id> updateCases = new List<Id>();
     for (Case c : Trigger.new){
         if (((c.isClosed == true)||(c.Status == 'Closed'))&&         ((c.SlaStartDate <= completionDate)&&(c.SlaExitDate == null)))          updateCases.add(c.Id); }
if (updateCases.isEmpty() == false) milestoneUtils.completeMilestone(updateCases, 'Resolution Time', completionDate); } }

error is : CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY : DefaultEntitlement: execution of AfterUpdate

caused by: System.FinalException: Record is read-only

Thanks in advance.
Ronald Van AkenRonald Van Aken
Hi Sandy,
You're trigger seems ok, although I had to reformat it to look for trouble.
I would look for the issue in your milestoneUtils class.
Maybe you could share that too if you want a second opinion.
Best regards,
Ron