+ Start a Discussion


I have a process builder on Email Message object, from this process builder i am updating case 'last_activity_date__c' with system .now() when a email is sent from case related list "send Email". I have a trigger on case which send an email when case is closed,
Now I am getting SELF_REFERENCE_ERROR. I tried changing the method causing error calling in trigger from before update to after update then I am getting 101 soql.
Can anyone have an idea how to solve this SELF Referece Error?
Error:Apex trigger CaseTrigger caused an unexpected exception, contact your administrator: CaseTrigger: execution of BeforeUpdate caused by: System.EmailException: SendEmail failed. First exception on row 0; first error: CANNOT_EXECUTE_FLOW_TRIGGER, We can't save this record because the “UpdateCaseFromRelatedEmail” process failed. Give your Salesforce admin these details. This error occurred when the flow tried to update records: SELF_REFERENCE_FROM_TRIGGER: Object (id = 50022000002xkHk) is currently in trigger CaseTrigger, therefore it cannot recursively update itself. You can look up ExceptionCode values in the SOAP API Developer Guide. Error ID: 671972233-138629 (1525238937): []: Class.UOP_CaseHandler.autoPopulateTimeStampAndSendEmail: line 535, column 1
Khan AnasKhan Anas (Salesforce Developers) 
Hi Surya,

Greetings to you!

Please refer to the below knowledge article which might help you further with the above issue.

https://help.salesforce.com/articleView?id=000324391&language=en_US&type=1&mode=1 (https://help.salesforce.com/articleView?id=000324391&language=en_US&type=1&mode=1)

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas