web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

This message can not be used to set the state of incident to Closed. In order to set state of incident to Closed, use the CloseIncidentRequest message instead.

(0) ShareShare
ReportReport
Posted on by 423

This did not work

SetStateRequest setState = new SetStateRequest();
setState.State = new OptionSetValue(1);
setState.Status = new OptionSetValue(5);

setState.EntityMoniker = incident.ToEntityReference();

var result = (SetStateResponse)service.Execute(setState);


So I tried to do that

https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.closeincidentrequest?view=dynamics-general-ce-9

BUT this

IncidentResolution resolution = new IncidentResolution
{
    Subject = "Case Closed",
};

Causes that

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'IncidentResolution' could not be found (are you missing a using directive or an assembly reference?)

The usings are

using System;
using System.Collections.Generic;
using System.Diagnostics;
using Ikarus.CRM.Plugins;
using Ikarus.CRM.Plugins.BusinessLogic;
using Microsoft.Crm.Sdk.Messages;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Query;
using Microsoft.Xrm.Tooling.Connector;

This are the references

references.png

Why does the compiler not recognize the subclass?

EDIT: Link corrected

*This post is locked for comments

I have the same question (0)
  • Verified answer
    David Jennaway Profile Picture
    14,065 on at
    RE: This message can not be used to set the state of incident to Closed. In order to set state of incident to Closed, use the CloseIncidentRequest message instead.

    The example you're using is written for early-bound entity classes. This depends on having generated these classes using the CrmSvcUtil tool. When you generate the classes you choose the .Net namespace.

    Alternatively you can use latebound classes, in which case the code would be:

    var resolution = new Entity("incidentresolution");
    resolution["subject"] = "Case Closed";


    Note that with the late-bound approach you always use the logical (lower-case) names for entities and attributes

  • bernhards Profile Picture
    423 on at
    RE: This message can not be used to set the state of incident to Closed. In order to set state of incident to Closed, use the CloseIncidentRequest message instead.

    That was doing the trick, thanks a lot. But how can I close the incident, without overwriting the already existing resolution or to create a duplicate?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
UllrSki Profile Picture

UllrSki 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans