Here's my trigger:
trigger updateFieldUponEmail on EmailMessage (before insert) {
//find parentId of EmailMessage
//where case.Id = parentId, increment number field isUpdated
SObjectField EmailMessageID = EmailMessage.parentID;
for(Case c: [SELECT timesUpdated__c FROM Case WHERE Id = :EmailMessageID]){
c.timesUpdated__c++;
}
}
I want it to increment a number field of a case that the EmailMessage is a child of. I'm fairly new to Java/APEX so I'm not sure how exactly to do this, but I got this far. However, I keep getting the error: Invalid bind expression type of Schema.SObjectField. What can I do? Thank you!