简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM