Skip to main content

Posts

Showing posts from February, 2019

Dynamic 365 SetStateDynamicEntity

Dynamic 365 SetStateDynamicEntity  I was working on a plugin that has to fire when record gets deactivated or activated. To handle this scenario I had to use SetStateDynamicEntity Message. When it comes to the plug-in code you have to look for “ EntityMoniker” as an EntityReferece on the context. Here is a snippet of code: if (context.InputParameters.Contains( "EntityMoniker" ) && context.InputParameters[ "EntityMoniker" ] is EntityReference ) To retrieve the State and Status values you can use the following code OptionSetValue state = ( OptionSetValue )context.InputParameters[ "State" ]; OptionSetValue status = ( OptionSetValue )context.InputParameters[ "Status" ]; Here is where things got interesting, if you are like me you are expecting the right value for the status “ statucode field value”, instead I started getting Status=-1; Which is not a valid value for the OptionSet field. Which made

Microsoft Dynamics 365 Developer Toolkit for Visual Studio 2017

Microsoft Dynamics 365 Developer Toolkit for Visual Studio 2017 If you are used to working with Microsoft Dynamics 365 Developer Toolkit in Visual Studio 2015 you will realize quickly that Microsoft didn’t provide a new version for Visual Studio 2017. Here are step to take Microsoft Dynamics 365 Developer Toolkit for Visual Studio 2015 and make it functional for Visual Studio 2017 1.        Download Microsoft Dynamics 365 Developer Toolkit from here 2.        Uncompressed the .vsix and open folder Locate extension.vsixmanifest 1.        Open in a text editor in my case I used Notepad and locate the following <Installation>     <!--<InstallationTarget Version="[11.0,12.0)" Id="Microsoft.VisualStudio.Pro" TargetPlatformVersion="4.0" />-->     <InstallationTarget Version="[11.0,14.0]" Id="Microsoft.VisualStudio.Premium" />     <InstallationTarget Version="[11.0,14.0]" Id=&qu

Dynamics 365 Creating Business Rule that work on Views

Business Rule on Views I was working on a business rule and noticed while it worked on the form it was not working on a system View. The Business Rule Scope was set up for Entity so logically this had to work, to my surprise the BR was working as expected on the Form and was not taking effect on the System View. I started doing some research and saw that many people are writing JavaScript to handle this issue, still I was not convinced that this can be done only with JavaScript. I approach the problem going back to the basics, for a Business Rule to work on a Form the Condition must contain a field on the form. Why not apply the same logic for The System View? Went through the System View to see if there was a field I can use for the condition, once I identified the right field I updated the Condition on my business Rule to a Field that was a column on the System View, upon activation of the BR I noticed it was working properly. So when you face this kind of  issue make su