function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kiran MarketingKiran Marketing 

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.
Best Answer chosen by Kiran Marketing
Mudasir WaniMudasir Wani
Hi Kiran,

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

Mudasir WaniMudasir Wani
Hi Kiran,

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.
 
This was selected as the best answer
Kiran MarketingKiran Marketing
Thanks Mudasir Wani. The link was very helpful appreciate your help.