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
Florencio Castillo 15Florencio Castillo 15 

Compile Error: Expecting '}' but was: '<EOF>' at line 8 column 1

Hello. I am getting this error: Compile Error: Expecting '}' but was: '<EOF>' at line 8 column 1

Here's the apex class:

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); // Pass your milestone parameters to the Apex Handler Class    }}
SubratSubrat (Salesforce Developers) 
Hello Florencio ,

The Apex trigger code you provided seems to have a mismatched curly brace that is causing the "Expecting '}' but was: '<EOF>'" error. To resolve this issue, you need to add an extra closing curly brace at the end of the trigger.

Here's the corrected Apex trigger code:
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); // Pass your milestone parameters to the Apex Handler Class
        }
    }
}
The code is now properly indented and the closing curly braces are placed correctly. Please make sure to check that the milestoneUtils class exists and is accessible from this trigger. Also, ensure that the class containing this trigger is saved and compiled successfully in Salesforce.

If this helps , please mark this as Best Answer.
Thank you.
Florencio Castillo 15Florencio Castillo 15
Hello,

I got this error now,  Compile Error: Unexpected token '{'. at line 1 column 1
Krishna VKrishna V
Hi Florencio, 

Can you post your code that is erroring out after the changes suggested by Subrat? 

Thank you
Florencio Castillo 15Florencio Castillo 15
Hi Krishna,

Here is the code:



{    
    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); // Pass your milestone parameters to the Apex Handler Class
        }
    }
}