In this blog, I will demonstrate how to trigger a plug-in in Dynamics 365 Customer Engagement when Product License is updated in Office 365 for a Dynamics 365 user.
1. Write a simple Plugin to update the field created in the previous steps
*Please be aware that best practices were not used in the construction of this plugin and it is only intended to test this functionality.
2. Register a plugin step as follow:
3. Register PreImage and PostImage for the plugin step registered in step #1
4. Turn on Plug-in Trace Log, for more information check the article
5. Login in the page
6. Navigate to Users > Active Users
7. Pick any user, click on the Edit button for the Product Licenses option
8. Switch the licenses for Dynamics 365 Customer Engagement to Off, click on the Save button
9. The synchronization between Office 365 and Dynamics 365 Customer Engagement could take some time, but once it synchronizes, go to Settings > Plug-in Trace Log, you will see an entry for the plug-in triggered by the action from step #8
10. Open the correct entry and check the Message block under the Execution section, it will be easier to visualize it, if you copy and paste it in a text editor like Notepad
11. Noticed that as you removed the licenses for a specific user, the attribute userlicensetype changed from 6 to -1
This post first appeared on MSDN Blogs | Get The Latest Information, Insights, Announcements, And News From Microsoft Experts And Developers In The MSDN Blogs., please read the originial post: here