2
votes

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 SetState and SetStateDynamicEntity messages but the plugin is not triggered.

Plugin Registration Steps:
Message: SetState & SetStateDynamicsEntity
Entity: systemuser
Event: Post-Operation

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:
Message: Update
Entity: systemuser
Event: Post-Operation
Filtering Attribute: All Fields
Image: Pre Image

Any help would much be appreciated.

2
Did you reach out to MS? - Arun Vinoth
No, but we will - Munavvar Husein
Right now, thinking on another approach i.e. LogicApp in Azure will be triggered on the update of the User entity. - Munavvar Husein
Any luck with Logic app or Flow? - Arun Vinoth
Yes, but seems a lot to manage as per our requirement. Hence, we have added a boolean field in User entity to clarify that this user is going to activate and we have managed update plugin. Then the user removes the license. - Munavvar Husein

2 Answers

0
votes

You are on the right track to be using the Update message, as the use of SetState is deprecated (as far as I know).

You might find this article interesting. It states:

When update requests are processed that include both state/status fields plus other standard fields, workflows registered for the Update message execute once for all non-state/status fields, and then once for the state/status fields. Workflows registered for the Change Status step continue to be triggered by updates to state/status fields.

However, users may be a little different as they have the isDisabled field. Maybe try filtering the trigger to just that field. And if that doesn't work, try triggering on a "regular" field just to make sure that you plugin can fire on the Update message.

Full disclosure: I have never had to write a plugin that fires on disable of a user.

However, since it does not seem to be firing when filtered down to isDisabled, I checked to see if an OOB workflow could trigger on that field. It is missing from the selection dialog, so apparently not:

User fields

You might want to get a Microsoft support ticket going to see what they say, but in the meantime, perhaps register it to trigger on ModifiedOn, with a pre-image and check for yourself whether isDisabled changed.

0
votes

We also experienced this issue, we were unable to achieve the plugin route.

Then we did a workaround scheduled job (to run every 24 hours) with SSIS + Kingswaysoft package to query the disabled users.

This system user status change is not getting trapped in Dynamics platform as we are not sure how the O365 changes like license removal or AD changes like account removal is getting replicated into Dynamics platform.