You need to sign in to do that
Don't have an account?
mdelgado
Getting Entity is Deleted error
Hello,
I am new to salesfoce. I have a code snippet that is giving me an Entity is Deleted error exception. Can someone tell me what is wrong with the code?
Lead lead = trigger.new[0]; List <Event> e1 = new List<Event>(); if (trigger.isUpdate) { e1 =[select id,subject from Event where Whoid =: lead.id AND Created_by_Trigger__c = true and IsRecurrence = false]; delete e1; } I modified the code to this, but exception also being thrown on delete Lead lead = trigger.new[0]; Event evs1; List <Event> e1 = new List<Event>(); if (trigger.isUpdate) { e1 =[select id,subject from Event where Whoid =: lead.id AND Created_by_Trigger__c = true and IsRecurrence = false]; for (integer i =0; i< e1.size();i++) { evs1 = e1[i]; delete evs1; } }
thanks,
Mirko
Change the event from "After Update" to "Before Update".
Umesh,
Thanks for your reply. I don't think that is the issue. I have the following on my trigger
Any other suggestions? Or am I missing something?
thanks,
Mirko
Are you trying to delete recurring events???
I believe you are trying to delete recurring events..When you create a recurring event then one series gets created and multiple events gets created for that series.If you delete series, all events would be deleted automatically...
Consider the following when deleting a series of events:
Hi Umesh,
Thanks again for your reply. I don't believe its a reoccurring event. The query (in code snippet) specifies: IsRecurrence = false
For now I have implemented a try/catch block when attempting to delete record. That seems to have solved my problem.
thanks,
Mirko