0

I have one custom checkbox field on Case named Check__c and I want it to be checked if the From Address of the incoming email message linked to that case is equal to the Case Owner's email. there is one custom field case_owner_email__c which holds the case owner email.

How can I check the condition for checking if the from address is equal to the case owner's email? I guess it will be handled as an after insert trigger only. My idea is that i create a map of case id and case owner email and do something after that but i am not getting a clear picture. Please advise.

Thanks in Advance, Alex

0

1 Answer 1

0

I followed the below approach :-

  1. Create a Set of ID to store all unique Case Id
  2. Loop through Trigger.New to fetch all Case Id(API Name = ParentId) and store in set
  3. Fetch all cases related to set of Case Id and run through Loop
  4. Before this loop create a Map<String, Case> and update it with Case Owner EmailId as Key and Case variable as value.

5.Run another loop on Trigger.New and compare FromAddress with Map's key if key contains then create a new list of case and add this case to the list and update Flag. After loop completion check if List of case is not blank then update it.

Hope this helps!

Not the answer you're looking for? Browse other questions tagged .