You need to sign in to do that
Don't have an account?

Trigger to Insert in diff objects and fails in one Object delete earlier inserted records in other objects.
I have 3 Objects and i have a senario where i have to write a trigger to insert records in 3 objects, however if the 3 object record fails to insert the earlier 2 inserted record should get deleted. help is highly appreciated.
You can definitely achieve this using transaction Control
Have a look on the following link.
https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_transaction_control.htm
Don't forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help.
All Answers
You can definitely achieve this using transaction Control
Have a look on the following link.
https://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_transaction_control.htm
Don't forget to select best answer to make our efforts visible in the developer forum.
Please mark this as solution by selecting it as best answer if this solves your problem, So that if anyone has this issue this post can help.