多次执行调用

发布于 2024-12-22 17:05:44 字数 737 浏览 0 评论 0原文

我正在尝试更新电话实体上的字段,然后将其关闭。据我所知,目前要做到这一点需要两个电话。但这速度慢得令人痛苦,因为处理 60 个电话需要 30 分钟,而我还有大约 200,000 个电话要做。有没有办法将两者合并到一个调用中?

这是我当前的代码 -

foreach (phonecall phonepointer in _businessEntityCollection.BusinessEntities.Cast<phonecall>()
     .Where(phonepointer => phonepointer.statecode.Value == PhoneCallState.Open))
{
  //Update fiserv_contactstatus value
  phonepointer.fiserv_contactstatus = Picklist;
  crmService.Update(phonepointer);

  //Cancel activity
  setStatePhoneCallRequest.PhoneCallState = PhoneCallState.Canceled;
  setStatePhoneCallRequest.PhoneCallStatus = 200011;
  setStatePhoneCallRequest.EntityId = phonepointer.activityid.Value;

  crmService.Execute(setStatePhoneCallRequest);
}

I'm trying to update a field on a phone call entity, then close it. Current to do so as far as I can tell, takes two calls. But this is painfully slow as it's taken 30 minutes to process 60 phone calls and I have around 200,000 to do. Is there a way to combine both into one call?

Here's my current code -

foreach (phonecall phonepointer in _businessEntityCollection.BusinessEntities.Cast<phonecall>()
     .Where(phonepointer => phonepointer.statecode.Value == PhoneCallState.Open))
{
  //Update fiserv_contactstatus value
  phonepointer.fiserv_contactstatus = Picklist;
  crmService.Update(phonepointer);

  //Cancel activity
  setStatePhoneCallRequest.PhoneCallState = PhoneCallState.Canceled;
  setStatePhoneCallRequest.PhoneCallStatus = 200011;
  setStatePhoneCallRequest.EntityId = phonepointer.activityid.Value;

  crmService.Execute(setStatePhoneCallRequest);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

酒解孤独 2024-12-29 17:05:44

不幸的是,您无能为力。

您可以尝试使用新的 SDK 和 XRM 上下文(强类型类)来批量更新电话呼叫实体(这应该更快),但您仍然需要使用老式的 CrmService 来实际一一改变每个实体的状态。

编辑:
您还可以直接更改数据库中实体的状态,但这应该是最后的手段,因为手动更改 CRM DB 不受支持且危险。

说真的,最后的手段!不,我不是在开玩笑!

Unfortunately, there's little you can do.

You COULD try and use the new SDK and the XRM context (strongly typed classes) to batch-update the phone call entities (this should be faster), but you'll still need to use the old-fashioned CrmService to actually change the state of each entity, one by one.

EDIT:
You could also directly change the state of the entities in the database, but this should be your last resort, as manual changes to the CRM DB are unsupported and dangerous.

Seriously, last resort! No, I'm NOT joking!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文