irohamca
irohamca

Reputation: 507

Dynamics CRM executing multiple requests c#

I want to update a field of an account and I have the guid of account.

Can I update the field (for instance, address of the account) without retrieve request using an update request?

Here my code

Entity account= _service.Retrieve("account", Guid.Parse(accountGuid), new ColumnSet(true));
account.Attributes["new_password"] = password;
_service.Update(account);

Is it possible to use ExecuteMultipleRequest in this scenario?

Upvotes: 0

Views: 722

Answers (1)

Guido Preite
Guido Preite

Reputation: 15128

If you have the Id of the record, yes, it can be done without a Retrieve.

Just write

Entity accountToUpdate = new Entity("account");
accountToUpdate.Id = Guid.Parse(accountGuid);
accountToUpdate["new_password"] = password;
_service.Update(accountToUpdate);

ExecuteMultipleRequest is used to batch multiple request at once, in that case you need to create first an UpdateRequest and add to the collection first, you can google for examples.

Upvotes: 1

Related Questions