You need to sign in to do that
Don't have an account?
Christos Kolonis
Trigger is not deleting the records which i have to delete
Hello,
I need a trigger which will run when the Opportunity is in stage "X". I have a handler apex class which checks if the Opportunity is in this stage and if it is, gets the Opportunity's attachments and deletes them. This Stage is updated by another apex class and trigger from another custom object. So, if i select manually the stage it functions as it should but if the stage is updated by the apex, my new trigger is not running. I am using before insert trigger. Any thoughts??
Thank you!
I need a trigger which will run when the Opportunity is in stage "X". I have a handler apex class which checks if the Opportunity is in this stage and if it is, gets the Opportunity's attachments and deletes them. This Stage is updated by another apex class and trigger from another custom object. So, if i select manually the stage it functions as it should but if the stage is updated by the apex, my new trigger is not running. I am using before insert trigger. Any thoughts??
Thank you!
Greetings!
I don't think before insert works to delete the child record(since an attachments considered as Child record for the Object).I would suggested you to go with the Before Update trigger as suggested in the below thread.
https://salesforce.stackexchange.com/questions/45566/deleting-child-records-on-a-parent
Kindly mark it as best answer if it helps so that it can help others in the future.
Warm Regards,
Shirisha Pathuri
My fault, my trigger is before update. Miss spelling!