You need to sign in to do that
Don't have an account?
Abby Stocker
Trigger from related Email Message
Hello! I am just starting out on the development side of SF. We had a company relate email messages with a custom object "claim" so that we were able to route incoming emails back to its associated claim (just like email to case). On the email message object, there is a "Incoming" checkbox field. I would like a "Email Received" checkbox to be put on the claim custom object so I can use it in a flow. The use for it in the flow is as follows: If the "Email Recieved" checkbox is true, DO NOT send email. Any help on how to relate those two checkboxes would be extremely appreciated!! Thank you!!
trigger EmailMessage on Claim__c (after insert, after update) {
For(Claim__c c : Trigger.new){
EmailMessage[]incomingEmail = [SELECT ToAddress,Incoming FROM EmailMessage];
if(incomingEmail.Incoming == true){
c.Email_Recieved__c=true;
}
else{
c.Email_Recieved__c=false;
}
}
}