Skip to main content

Posts

Why do you need an inventory of Browsers? IE 11

As a developer you need to know which browsers are used by Dynamic 365 Users in your organization. The reason for this is quite simple, it will dictate your way of programming when it comes to scripting. Most browsers majority of the time react the same way to JavaScript giving you a more predictable outcome, when it comes to IE 11 you have to be more careful, even though JavaScript has evolved since ECMAScript 5 IE 11 still using ECMAScript 5 and I am sure you have a handful of users that are on IE 11 in your organization. ECMAScript 5 has so many limitation, yes you can use application like Babel to convert your code to ECMAScript 5 while coding with the latest version, if you have seen the output of Babel its not that palatable for my taste, it injects code to mitigate the shortcoming of ECMAScript 5, if you work with many developers I don’t think you are inclined to introduce a new process to generate your JavaScript files. There are few things you can do Short term solu...

Dynamics 365 Open Quick Create Form and Save/Refresh calling record

If you are working in a scenario where you have to open Quick Create Form through JavaScript and save/refresh the calling record after the quick create form has been saved, you have few choices. In this article I will show you how you can leverage the async and await operators in JavaScript to solve this scenario. First thing let’s try to define async and await Async : - pretty much a function that returns a promise Await : - makes JavaScript wait until the promise has been settled. First thing let’s define the function that is going to Open Quick Create Form function QuickCreate() {     var entityFormOptions = {};     entityFormOptions[ "entityName" ] = "contact" ;     entityFormOptions[ "useQuickCreateForm" ] = true ;     // Set default values for the Contact form     var formParameters = {};     formParameters[ "firstname" ] = "Sample" ;     ...

Why is it a bad idea to hardcode workflow id in your code?

You might have faced a scenario where you have to trigger workflows or an actions through plugins or JavaScript code. And you might have hard coded the workflow id in your code. There are few things that I would like you to reconsider before you get tempted to hardcode the workflow id in your code. Take a workflow name that you have been working lately and replace it on the following fetchxml. < fetch top = " 50 " >   < entity name = " workflow " >     < attribute name = " versionnumber " />     < attribute name = " name " />     < filter >       < condition attribute = " name " operator = " eq " value = " Workflow Name " />       < condition attribute = " statecode " operator = " eq " value = " 1 " />     </ filter >     < order attribute = " versionnumber " />   ...

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" /...

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 mak...

Crm 2011 Display Image for a contact JavaScript

Crm 2011 Display Image for a contact JavaScript This is an easy way to display an image attached to a contact on contact form I am using the XrmServiceToolkit.js from CodePlex. Create Image.html  which will be used as a html web resource, we will be adding this web resource on the contact form  <! DOCTYPE html > < html xmlns ="http://www.w3.org/1999/xhtml"> < head >     < title ></ title >     < script src ="../ClientGlobalContext.js.aspx" script type ="text/javascript" ></ script >     < script src ="../js/jquery.js"></ script >     < script src ="../js/json2.js"></ script >     < script src ="../js/XrmPage-vsdoc.js"></ script >     < script src ="../js/XrmServiceToolkit.js"></ script >     < script src ="../js/ContactImage.js">...