【问题标题】:While updating the entity in MS CRM 2015 error message更新 MS CRM 2015 中的实体时出现错误消息
【发布时间】:2018-06-11 05:46:06
【问题描述】:

我在 crm 2015 中有一个事件表单。在 spme 操作之后,事件实体变得被动。在我的数据库中,被动事件是通过查看状态和状态列来理解的。如果事件是被动的,则状态码变为 1,状态码变为 5。

事后变得被动。我想对那个事件实体做点什么。

作为操作员,我想更改状态和状态以激活事件。 (状态=0,状态=1)

如果我成功了,我想将 new_anketgonderildi 字段(位字段)更新为 true。然后再次使事件被动并更新实体。

但我在更新实体时出错。

这个案子已经解决了。关闭并重新打开案例记录以查看更新。

我意识到如果事件处于活动状态,我可以更改 new_anketgonderildi 字段。当事件处于被动状态时我无法改变。要更改位值字段,我必须激活事件更改位字段,然后再次停用事件。

我怎样才能实现这种情况? code enter image description here

【问题讨论】:

  • 请编辑使用 Markdown 格式,尤其是图片块。
  • 你访问过这个link吗?

标签: c# crm


【解决方案1】:

这正是 CRM 的工作方式。有许多实体(包括案例/事件)一旦变为非活动(被动)就无法再编辑。

您将需要;

  1. 在关闭案例之前更新new_anketgonderildi
  2. 重新激活已关闭的案例,更新new_anketgonderildi,然后再次关闭案例。

Sample: Validate record state and set the state of the record中有一个后面的例子。

private void SetState(EntityReference caseReference)
{
    // Open the incident

    // Create the Request Object
    SetStateRequest state = new SetStateRequest();

    // Set the Request Object's Properties
    state.State = new OptionSetValue((int)IncidentState.Active);
    state.Status = new OptionSetValue((int)incident_statuscode.WaitingforDetails);

    // Point the Request to the case whose state is being changed
    state.EntityMoniker = caseReference;

    // Execute the Request
    SetStateResponse stateSet = (SetStateResponse)_serviceProxy.Execute(state);  
}


private void CloseIncident(EntityReference caseReference)
{
    // Close the Incident

    // Create resolution for the closing incident
    IncidentResolution resolution = new IncidentResolution
    {
        Subject = "Case Closed",
    };

    resolution.IncidentId = caseReference;

    // Create the request to close the incident, and set its resolution to the 
    // resolution created above
    CloseIncidentRequest closeRequest = new CloseIncidentRequest();
    closeRequest.IncidentResolution = resolution;

    // Set the requested new status for the closed Incident
    closeRequest.Status = new OptionSetValue((int)incident_statuscode.ProblemSolved);

    // Execute the close request
    CloseIncidentResponse closeResponse = (CloseIncidentResponse)_serviceProxy.Execute(closeRequest);
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-21
    • 2012-04-30
    • 2015-09-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多