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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

SetState in PostUpdate plugin

(0) ShareShare
ReportReport
Posted on by

Hi , guys ! I have question. Can I use SetState in PostUpdate plugin of entity ? May be a problems from that ? Thanks

I have the same question (0)
  • cloflyMao Profile Picture
    25,210 on at

    Hi aleenav,

    Do you want to trigger the plugin on activation/deactivation of entity to update the entity field data?

    If so, yes, we can use SetState message  in PostOperation stage, and registration to SetStateDynamic  stage is also required.

    That because  both messages perform the same action in CRM and  as there is no typical thumb rule  for which action SetState/SetStateDynamic  message is fired, its better to register the plugin for  both messages  so that  our plugin works properly.

    pastedimage1609487978599v2.png

    Here is sample code for the plugin and I ran it successfully in my Dynamics 365 online environment.

    http://burnignorance.com/ms-crm-app-development-tips/plugin-for-setstate-message/

    In addition, here is another article about SetState message behavior:

    https://nishantrana.me/2018/07/11/when-does-the-plugin-registered-on-setstate-message-fires-in-dynamics-365/

    Regards,

    Clofly

  • Verified answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    You don't need to use setstate if you want to change status of the record from post update plugin. You can simply add the field in entity object and use service.update to change record status.

    please see below link for more details.

    docs.microsoft.com/.../entity-operations-update-delete

    Please mark my answer verified if i were helpful

  • Suggested answer
    Community Member Profile Picture
    on at

    Thanks

  • Community Member Profile Picture
    on at

    Thank you very much !

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 128 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 95

#3
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans