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
Dee Dee AaronDee Dee Aaron 

Simple APEX class won't save.

Hi. I am adding this APEX class referenced in the following article:
https://automationchampion.com/tag/auto-delete-record-using-process-builder/

It won't save because I'm getting the following error:
Error: Compile Error: Unexpected token 'List'. at line 6 column 9

Thank you for your help.

Code listed here:
public class DeleteUnaccepted
Quotes {     @InvocableMethod    
public static void QuoteDelete(List<Id> OpportunityIds)    
{        
List Quotes =[select id from quote                          
where Opportunity.id in :OpportunityIds                       
and Status != 'Accepted'];        
delete Quotes;   
}
}

Best Answer chosen by Dee Dee Aaron
ShirishaShirisha (Salesforce Developers) 
Hi Dee,

Greetings!

The way of using List is incorrect in the above code.Can you please try by using the List as below:

List<Quotes> variable=[select id from quote                          
where Opportunity.id in :OpportunityIds                       
and Status != 'Accepted'];

delete variable;

Kindly mark it as best answer if it helps so that it can help others in the future.

Warm Regards,
Shirisha Pathuri