C# 更新MS CRM 2015中的实体时出现错误消息

C# 更新MS CRM 2015中的实体时出现错误消息,c#,crm,C#,Crm,我在crm 2015中有一个事件表。spme操作后,事件实体变为被动。在我的数据库中,通过查看state和status列可以理解被动事件。如果事件为被动事件,状态代码变为1,状态代码变为5 事件发生后,情况变得被动。我想对那个事故实体做点什么 作为操作员,我希望更改状态和状态以激活事件。(状态=0,状态=1) 如果成功,我希望将新的_anketgonderildi字段(位字段)更新为true。然后再次使事件处于被动状态并更新实体 但我在更新实体时出错 这个案子已经解决了。关闭并重新打开案例记录以

我在crm 2015中有一个事件表。spme操作后,事件实体变为被动。在我的数据库中,通过查看state和status列可以理解被动事件。如果事件为被动事件,状态代码变为1,状态代码变为5

事件发生后,情况变得被动。我想对那个事故实体做点什么

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

如果成功,我希望将新的_anketgonderildi字段(位字段)更新为true。然后再次使事件处于被动状态并更新实体

但我在更新实体时出错

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

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

我怎样才能达到这种情况?
这正是CRM的工作方式。有许多实体(包括案例/事件)一旦处于非活动状态(被动),就无法再进行编辑

你要么需要

  • 在结案前更新
    new_anketgonderildi
  • 重新激活已关闭的案例,更新新的_anketgonderildi,然后再次关闭案例
  • 其中有一个后一种方法的例子


    请编辑以使用标记格式,尤其是图像块。您访问过此网站吗?
    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);
    }