Skip to main content

Notifications

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

  • Community Member Profile Picture
    on at
    RE: SetState in PostUpdate plugin

    Thank you very much !

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: SetState in PostUpdate plugin

    Thanks

  • Verified answer
    Bipin D365 Profile Picture
    28,981 Moderator on at
    RE: SetState in PostUpdate plugin

    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

  • cloflyMao Profile Picture
    25,208 on at
    RE: SetState in PostUpdate plugin

    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

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard >

Product updates

Dynamics 365 release plans