如何更新 Dynamics CRM 2011 的 silverlight/odata 项目中的状态(打开、完成)

发布于 2024-11-07 14:19:47 字数 446 浏览 0 评论 0原文

我有一个在线托管在 CRM 2011 中的 silverlight 应用程序。我有功能可以更新电话并以小形式显示两个字段。我需要标记为完成,但我似乎在这里失败了。

我有:

phoneCall.StateCode.Value = 1;

phoneCall.Subject = activity.Subject;
phoneCall.Description = activity.Description;

_context.UpdateObject(phoneCall);
_context.BeginSaveChanges(OnChangesSaved, phoneCall);

主题可以正常工作并保存以及描述,但状态代码不能。 StateCode 不为 null,这是一个现有对象,当前设置为 0(打开)。保存不会影响 StateCode。我在 try-catch 中有这个,没有报告错误。

I have a silverlight app hosted in CRM 2011 online. I have functionality where I am updating a phone call and display two fields in a small form. I have the requirement to mark as complete but I seem to be failing here.

I have:

phoneCall.StateCode.Value = 1;

phoneCall.Subject = activity.Subject;
phoneCall.Description = activity.Description;

_context.UpdateObject(phoneCall);
_context.BeginSaveChanges(OnChangesSaved, phoneCall);

The subject works and saves as well as the description but the statecode does not. StateCode is not null this is an existing object and it's currently set to 0 (open). The save does not affect the StateCode. I have this in a try-catch and no error is being reported.

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

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

发布评论

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

评论(1

別甾虛僞 2024-11-14 14:19:47

记录的状态无法通过 Update 消息更改。为了更改状态代码或状态代码,您必须发出 SetStateRequest

var setStateRequest = new SetStateRequest
{
  EntityMoniker = new EntityReference({LogicalName}, {Id}),
  State = new OptionSetValue(1),
  Status = new OptionSetValue(1)
};

_context.Execute(setStateRequest);

更新


REST 端点有一些限制

REST 端点提供了 WCF SOAP 端点的替代方案,但目前存在一些限制。

  • 只能对实体记录执行创建、检索、更新和删除操作
    无法执行需要 Execute 方法的消息。

这对您来说意味着:您无法使用 REST 端点更改状态。您必须使用 WCF SOAP 端点来执行此任务。

The status of a record cannot be changed with an Update message. In order to change the statecode or status code, you have to issue a SetStateRequest.

var setStateRequest = new SetStateRequest
{
  EntityMoniker = new EntityReference({LogicalName}, {Id}),
  State = new OptionSetValue(1),
  Status = new OptionSetValue(1)
};

_context.Execute(setStateRequest);

Update


The REST endpoint has some limitations.

The REST endpoint provides an alternative to the WCF SOAP endpoint, but there are currently some limitations.

  • Only Create, Retrieve, Update and Delete actions can be performed on entity records
    Messages that require the Execute method cannot be performed.

This means for you: you cannot alter the state with the REST endpoint. You have to use the WCF SOAP endpoint for this task.

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