Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2021 Release Wave 1Discover the latest updates and new features to Dynamics 365 planned April 2021 through September 2021.
Release overview guides and videos Release Plan | Preview 2021 Release Wave 1 Timeline
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
One of the more common use cases in Microsoft Dynamics 365 tends to be writing plugins and needing to pass parameters that the plugin code can use.
The traditional format to pass parameters has been XML that is pasted in the unsecure configuration. Parsing XML tends to be cumbersome and one ends up writing more code and spends more time maintaining that code rather than focusing on the business logic within the plugin. The question is: can we do any better?
Yes, there is a better way! The following process is what we tend to use to simplify this task:
Build a class that contains the variables that you want to pass in through the unsecure configuration.
For the purposes of our example, our class definition looks like the screenshot below.
Instantiate the object and serialize it. You could use JSON.NET or write your own. In either case, the serialized output will be similar to below.
Paste the JSON in the unsecure config of your plugin step.
In your plugin code, deserialize the JSON as follows
Code for the Deserialize method is below.
Sample code for the JsonHelper class was derived from this Microsoft article.
Now you are free to use variables defined within the reserialized object as you need in your plugin code. Mission accomplished!
For additional information, check out the following blogs:
Setting Output Parameters in Plugins for Custom Actions
Happy Dynamics 365’ing!
Business Applications communities