When Dynamics 365 is used to its full enterprise capacity, often a composite operation will span multiple CRUD operations and will need to be executed atomically. Such requirements typically dictate that if any of the operations were to fail, the entire process must roll back to ensure data integrity.
As of Dynamics CRM 2015, ExecuteTransactionRequest was introduced in the SDK libraries, allowing custom code to execute within a single database-level transaction.
In this recipe, we will create an account and a contact within the scope of a single transaction.