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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Suggested Answer

incident reactivate event

(0) ShareShare
ReportReport
Posted on by 56

Good Day

We have a requirement from Customer Experience, why a Case is ReActivated. They are asking for a drop down optionset and it should apprear only once a case is Re-Activated.

I tried Nishant Rana Blog, which creates a plugin and it is supposed to be activated once a Case is Re-Open/Re-Acticated.

Nishant Rana Code is not working for me, It is even running when a case status is Changed(New->In Progress). 

My plugin Code below:

if (context.InputParameters.Contains("EntityMoniker"))

           {

               var targetEntity = (EntityReference)context.InputParameters["EntityMoniker"];

               if (targetEntity.LogicalName == "incident")

               {

                   Entity incident = new Entity("incident");

                   incident.Id = context.PrimaryEntityId;

 

                   QueryExpression query = new QueryExpression("incident");

                   query.ColumnSet = new ColumnSet("col1""reopenflag");

 

                   query.Criteria.Conditions.Add(new ConditionExpression("incidentid", ConditionOperator.Equal, incident.Id));

                   var result = service.RetrieveMultiple(query);

                   foreach (var entity in result.Entities)

                   {

                       // Get the Columns from the Entity Obj Like this. Depands on type of the Column.

                       _valueDate = entity.Contains("field1") && entity["field1"] != null ? entity["field1"]).Value : DateTime.MinValue;

                   }

 

                  

 

                   int state = ((OptionSetValue)context.InputParameters["State"]).Value;

 

                   if (state==0)

                   {

                       incident.Attributes["flag"] = true;

             

                           incident.Attributes["field1"] = GetValidLocalDate(DateTime.Now);

             

                       

                       incident.Attributes["pluginmessage"] = Convert.ToString(context.MessageName);

                       service.Update(incident);

                   }

 

 

               }

           }

I have the same question (0)
  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    You should check Case previous status. And if pervious status is Resolved or Cancelled then only you should execute your code.

    Two thing you will have to check in your plugin -- Case previous status and Case status value which is coming in Context.

    When you check previous status and when case status is changed from New-->Inprogress your code will not get executed as previous status is not resolved or cancelled instead it is new.

    Please mark my answer verified if i were helpful

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 170 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 61

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 52 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans