Notifications
Announcements
No record found.
Hi , guys ! I have question. Can I use SetState in PostUpdate plugin of entity ? May be a problems from that ? Thanks
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.
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
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
Thanks
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Pallavi Phade 98
Tom_Gioielli 60 Super User 2025 Season 2
Gerardo RenterÃa Ga... 43 Most Valuable Professional