com and apex triggers
I have two objects namely Customer_c and Order_c I am trying to write a trigger to delete an order entry belonging to a customer who has been made inactive.
Basically i want to trigger on update for customer_c table
retrieve an entry from customer_c where the Active_c( boolean value) has been made false upon update and take that customers 'Name' and look up in the Order_c table and delete all the 'Name'(Orders) belonging to that customer.
Below is my trigger code. when I am trying to save the trigger in salesforce. I get the following error:
Error: Compile Error: unexpected token: 'res2' at line 13 column 19
Could anyone please help me on this?
trigger NewCustomerActive on Customer__c(after update) {
List<Customer__c> res2 =
[SELECT Name FROM Customer__c j WHERE j.Active__c = false];
List<Order__c> res =
[SELECT Name FROM Order__c WHERE Customer__c = res2];
}