I am using Dynamics 365 Online Trial. I have a requirement to trigger a plugin when the user is disabled/enabled in CRM. So I have created the plugin and registered the same in User entity
SetStateDynamicEntity messages but the plugin is not triggered.
Plugin Registration Steps:
Message: SetState & SetStateDynamicsEntity
User records have been Enabled/Disabled in CRM (through O365) but the plugin is not triggered.
Also tried with update message plugin for the same requirement, but that is also not triggering the plugin.
Updated Plugin Registration Steps:
Filtering Attribute: All Fields
Image: Pre Image
Any help would much be appreciated.
You should be able to register the plugin on update.
Check at the start of your plugin, if entity contains attribute state , meaning it has changed then do your logic otherwise exit the plugin.
You could also have pre and post images containing the status and check if pre status does not equal post status then that means it has changed
Hope this helps
AFAIK, the plugin will not get triggered as user enabling/disabling is an event inside Office 365, not particularly Dynamics 365 (though in effect, it does change the systemuser record with Dynamics365).
No point in trying the SetState/SetStateDynamicEntity plugin messages as the systemuser do not have those fields. However, worth a shot to try the event on UPDATE of the isdisabled or islicensed fields.
The only real solution here is to have a job running every hour or so to check the recently disabled users and then execute the remaining code. But this obviously means that this is not in real-time.
PS: Can you check if there are any Flow connectors/events for this specific use-case?
Worst case scenario, try a support ticket with MS and see if this is some configurable setting they can do on their end. See Jason Lattimer’s response here -> https://community.dynamics.com/crm/f/117/t/256689