Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Incident with ID Does Not Exist Error

Posted on by 990

Hi All,

We have plugin register on Case entity with post operation, wherein we have condition that while saving the case record close the case automatically, below is the code snippet;

We are upgrading our CRM from CRM 2011 to CRM 2016. The same line of code got executed in CRM 2011, CRM 2013 and CRM 2015, but its throwing ID does not exist error in CRM 2016. Could you please help me here.

Entity caseResolution = new Entity();
caseResolution.LogicalName = "incidentresolution";
caseResolution.Id = Guid.Empty;
caseResolution["incidentid"] = new EntityReference() { Id = incidentId, LogicalName = "incident" };
caseResolution["subject"] = title;

caseResolution["actualend"] = DateTime.UtcNow;

OrganizationRequest request = new OrganizationRequest() { RequestName = "CloseIncident" };
request["IncidentResolution"] = caseResolution;

request["Status"] = new OptionSetValue() { Value = 950000015 }; //950000015=Submitted  

service.Execute(request);

Regards,

Rahul

*This post is locked for comments

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Incident with ID Does Not Exist Error

    Hi Rahul,

    The only thought coming in my mind regarding version change is the way to close the incident using plugin/c#. Probably Microsoft has changed something in DLLs.

    So better to give a try with the code that I had shared with you earlier so that we can atleast get the direction to find the root cause and investigate it further.

    Hope it works.

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: Incident with ID Does Not Exist Error

    Hi Rahul,

    Seems the issue is here in below line .Since the sdk dll you are referencing in plugin is old version.

    IncidentId = new EntityReference(Incident.EntityLogicalName, _incidentId)

    Try to update sdk dll  8.1 version probably you can not build your plugin you will get error with additional parameters _incidentId here in above line.

    Try to fix this issue . Hopefully it will work.

  • Rahul-Waghmare Profile Picture
    Rahul-Waghmare 990 on at
    RE: Incident with ID Does Not Exist Error

    Hi Arpit,

    Thanks for reply, yes we do have send email functionality before case get resolved.

    I got this code snippet which you suggested, but my question here is, the same code runs on CRM 2011, CRM 2013 and CRM 2015, then what is the issue with CRM 2016.

    Regards,

    Rahul

  • Suggested answer
    Arpit Shrivastava Profile Picture
    Arpit Shrivastava 7,518 User Group Leader on at
    RE: Incident with ID Does Not Exist Error

    Hi Rahul,

    Is there any other Sync Plugin/Workflow running on Case Resolution? or any other action you are performing as soon as case get resolved. Like, send email/SMS?

    Also, try using below syntax in order to close the case:

    IncidentResolution resolution = new IncidentResolution
    {
    Subject = "Resolved Sample Incident",
    IncidentId = new EntityReference(Incident.EntityLogicalName, _incidentId)
    };

    // Close the incident with the resolution.
    CloseIncidentRequest request = new CloseIncidentRequest
    {
    IncidentResolution = incidentResolution,
    Status = new OptionSetValue((int)incident_statuscode.ProblemSolved)
    };

    CloseIncidentResponse closeResponse = (CloseIncidentResponse)service.Execute(closeIncidentRequest);

    -Arpit

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans