Hi,
I want to perform conditional updates on the CRM database. For this, I want to perform Create-Update and Update-Delete in a single transaction so that if anything goes wrong with the any request, everything will be rollback.
I am aware of Rollback. But my question here is on the executing a single transaction with multiple request ex. one with CreateRequest and 2nd with UpdateRequest. Can we execute these requests in a single transaction?
Something like below code:
var transReq = new ExecuteTransactionRequest()
{
// Create an empty organization request collection.
Requests = new OrganizationRequestCollection(),
ReturnResponses = true
};
var account = new Account()
{
Name = "Acme, Inc."
};
var createReq = new CreateRequest
{
Target = account
};
transReq.Requests.Add(createReq);
account.NumberOfEmployees = 100;
var updateReq = new UpdateRequest
{
Target = account
};
transReq.Requests.Add(updateReq);
var response = (ExecuteTransactionResponse)svc.Execute(transReq);
Any thoughts or ideas to achieve this?
*This post is locked for comments
I have the same question (0)