Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Sales forum / Trigger Plugin on Reso...
Sales forum

Trigger Plugin on Resolve incident

(0) ShareShare
ReportReport
Posted on by 165

Hi, in D365 I'm trying to write a plugin that do somethings when I close the incident (that is when the statecode change from 0 = Active to 1 = Resolved). I read in this post [https://community.dynamics.com/365/customerservice/f/763/t/304048] that D365 no longer supports the registration of the plugin on the Close message of the incident, so I'm using SetStateDynamicEntity.

This is the configuration:
Message: SetStateDynamicEntity
Primary Entity: incident
Secondary Entity: none
Stage of Execution: PostOperation
Execution Mode: Synchronus

The code:

// . . .
if (context.InputParameters.Contains("EntityMoniker"))
{
    EntityReference incidentRef = (EntityReference)context.InputParameters["EntityMoniker"];

    var incident = service.Retrieve(incidentRef.LogicalName, incidentRef.Id, new ColumnSet(true));

    var state = new OptionSetValue(((OptionSetValue)context.InputParameters["State"]).Value);
    
    if (state.Value == 1)
    {    // do somethings . . .   }
}
// . . .


The Plugin not trigger when I close incident, but run when I reactivate the incident.
I tryed also whit trigger plugin on Create of incidentresolution...

Thank you!

Categories:
  • Antonio Lamanna Profile Picture
    165 on at
    RE: Trigger Plugin on Resolve incident

    Thank you but this way not works. When I resolve I'll post here the solution!

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at
    RE: Trigger Plugin on Resolve incident

    Do not profile the plugin for close action. Try to throw an exception and see what happens or else add tracing and check plugin trace log by enabling it for all plugins through system settings.

    If found useful, please mark this answer as verified.

  • Antonio Lamanna Profile Picture
    165 on at
    RE: Trigger Plugin on Resolve incident

    Hi, thank you for your answer but the plugin not trigg.

    I tried to profile this Step from Plugin Registration Tool but instead of alert I see a form notification

    before this I could debug, now I can't.

    2019_2D00_05_2D00_29-12_5F00_51_5F00_49_2D00_Window.png

    Così

  • Suggested answer
    Kalpavruksh D365 CoE Profile Picture
    2,545 on at
    RE: Trigger Plugin on Resolve incident

    Hi Antonio,

    Please register plugin on Close message.

    MicrosoftTeams_2D00_image-_2800_5_2900_.png

    The context will return the following:                                                                                                                                                                      if (context.MessageName == "Close")
                {
                    Entity incRes = context.InputParameters["IncidentResolution"] as Entity;
                    fsTicketID = ((EntityReference)incRes.Attributes["incidentid"]).Id; }
    Please mark this answer as verified, if it has helped you.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,886 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,768 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans