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.
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:
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.
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.
You can try registering a plugin on Update of userlicensetype is SystemUser entity
Related
I'm having more issues that I'd expect trying to add a validation rule to contacts. The issue is that I'm experiencing workflow creep.
I rely on process builder and flows to keep certain objects in sync. Let me give you an example, say I have a contact with two flags: mailing and shipping. Let's also say I have another object called contact role, which also has flags for billing and shipping. I have workflows that keep these flags in sych, so if mailing is checked/unchecked on one record, it will run a flow to update the related record (contact to contact role and vice versa). Now enter the validation role. I've added a validation role that will trigger when the contact status is "inactive" and either one of these checkboxes are checked.
The issue I seem to be having is that if I am to uncheck both of these on a contact and set status to inactive, the validation rule causes a workflow error because the updates to the flags and updating of the related records is not done at once; there are two separate flows. So the first thing to occur is that the mailing checkbox is unchecked, and its related record is unchecked. Then I get the workflow error, due to I'm assuming the record saving with the mailing checkbox still checked on the record.
My assumption would be that the validation rule would not fire until ALL workflows have finished. Is this not the case? I also question whether the recursion setting on the workflows could be the culprit here. Obviously if ALL workflows finish before the validation runs, it should pass as both checkboxes should be unchecked in the final state.
Validation rules are processed well before any workflow rules are processed. The order of processing precedence is documented is this Knowledge Article and the Apex Developer Guide
Our company wants to know when the case activity is 75% of the original estimated hours.
However, I think that might be a bit of a tough call.
So, can someone explain how to send an email notification from Microsoft Dynamics CRM when someone logs any kind of "case activity" against a case? I am happy to use .NET code if necessary.
Create a workflow against the 'case activity' entities, add a condition to the workflow to only send an email when the the 'case activity' is related to a case. E.g. regarding case contains data.
I would prefer a Plugin for this kind of thing because you can do a lot more within a Plugin's context.
This is what I would imagine:
Whenever an activity record is created/modified/deleted; if it is regarding a case, the plugin will execute:
Get all regarding activities for the case
Sum up the Duration
If the Duration Total is 75% of the Case Estimate then fire a
workflow
The workflow will then be configured to send an email. By combining the plugin with a workflow, you allow the email to be configurable if the wording/recipients/from needs to change in the future.
I would probably also pass in the 75% as a configuration setting to the plugin so that this is also semi-configurable (doesn't involve code - but you'd need to modify the plugin registration).
The plugin would need to cater for
New Activities being added
Existing Activities being edited (Duration and/or State changes)
At first I thought you would also need to handle Deletes, but that would drop the Duration below the 75% so you wouldn't need to send an email.
I would like to have a field automatically be populated with something I define in a workflow. Currently I have the workflow running upon record creation, however the field is only populated AFTER the user saves the record for the first time.
How can I use a workflow to populate that field before the user saves the form?
You can't. Workflows function on the server-side, but you're asking about populating a client-side field before the server is contacted. Moreover, workflows are triggered asynchronously, which by definition means the record has to be created in advance.
You'll need to either attach a JavaScript function to the OnSave event, or trigger the population of the field in a pre-validation or pre-operation .NET plugin. I suppose you could use a Dialog as well, but that would require user input. See the below links for more detail on the differences between plugins, workflows, and dialogs.
Options: Plugin, Workflow or Dialog
Automate Business Processes in Microsoft Dynamics CRM
Just a quick question I wasn't able to Google-fu about CRM 2011 plug-in behavior. If I have a plug-in on, let's say Account, that updates another entity, let's say Contact, plug-ins registered on Contact messages will fire (correct?).
If those plug-ins are registered as synchronous will the Account plug-in have to wait for the Contact plug-ins to finish executing before it's execution is completed? Does the chaining of the plug-ins create a blocking situation?
Chris,
To your first question that plugins registered on Contact messages will fire? That is correct. and if you have selected synchronous that meaans:
The account plugin gets triggered makes some changes to the contact entity, and then the contact entity plugin makes some changes to contact entity. Only if the contact plugin finished without error then all the changes will apply, if not the contactplugin does a roll back aswell as the Account plugin. So no changes will be applied.
With Asynchronous it means that if the account plugin is finished, regardless if the contact plugin finishes without error, the changes apply to the contact entity.
We're building a system that is tightly integrated with a clients CRM install, and need to have a callback fired when an entity is updated, created or deleted. This callback will ideally send the entity name and id to an external service via a HTTP get request.
I've not found any docs online that help - can anyone point me in the right direction?
You're looking for plugins: http://msdn.microsoft.com/en-us/library/dd393295.aspx.
You can register a plugin on Create, Update, Delete, etc. of an entity, and then run any custom code you'd like. You'll definitely have access to the entity name and the id, as well as fields that were updated, information on the user who initiated the call, etc.
Just know that in MSCRM 3.0 & 4.0, plugins run outside the actual database transaction, so it's possible the event could fire in CRM, but the plugin fails and the event still goes through. In MSCRM 2011, they run inside the transaction, and can stop the CRM event from happening if need be.