Dynamics CRM 2015 Update 1 Series (7): Message transactions, dynamicscrm
Dynamics CRM 2015 Update1 can now put multiple messages in the same transaction pipeline for execution. This is indeed an excellent Feature, so that we can flexibly combine different messages to achieve complex business needs without worrying about rollback details after processing failure.
The method is also very simple. Call the ExecuteTransactionRequest message, put the message to be put into the transaction, and submit it to the server for unified execution. Let's take a look at the following code snippet:
ExecuteTransactionRequest req = new ExecuteTransactionRequest (); req. requests = new OrganizationRequestCollection (); DeleteRequest delReq = new DeleteRequest (); delReq. target = new EntityReference ("account", Guid. parse ("{8b7228cf-fc21-e511-80e1-4253bb2e7cd8}"); DeleteRequest delReq2 = new DeleteRequest (); delReq2.Target = new EntityReference ("account", Guid. newGuid (); req. requests. add (delReq); req. requests. add (delReq2); CrmSvc_Online.Execute (req );
The second message will report an error. The final result is: no records are deleted. Is it cool?
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.