简体   繁体   English

Dynamics CRM执行多个请求C#

[英]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? 在这种情况下可以使用ExecuteMultipleRequest吗?

If you have the Id of the record, yes, it can be done without a Retrieve. 如果您有记录的ID,可以,无需检索即可完成。

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. ExecuteMultipleRequest用于一次批处理多个请求,在这种情况下,您需要首先创建一个UpdateRequest并首先添加到集合中,您可以在Google上搜索示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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