Using ExecuteMultiple C# in Dynamics 365

ExecuteMultiple in Dynamics 365 is used to execute multiple requests, as opposed to executing requests one at a time. For example, if you wanted to create 5 contacts in Dynamics 365 through code, you could call Create 5 times, or you could call ExecuteMultiple once, with the 5 entity objects defined. This is useful if network latency is an issue. Let’s create a console app that creates 5 contacts using … Continue reading Using ExecuteMultiple C# in Dynamics 365

Using Upsert In C# Dynamics 365

In this post we will look at how to use Upsert to insert/update a record in Dynamics 365. Let’s say we have a contact in the system, Bob Smith: We would like to do an upsert on Bob Smith. To do this, we need to find his record using a key, so the system can decide whether to do the insert or update. To do this, we use Alternate Keys. … Continue reading Using Upsert In C# Dynamics 365

Passing Context from a Toolbar Button in Dynamics 365 UCI

In this post, we will look at how to pass context from a toolbar button in Dynamics 365 in the Unified Client Interface (UCI). Let’s add a custom button to the Contact form and call a JavaScript which will pass the context. First, let’s create a new JavaScript web resource: We will pass the context as the first parameter: Code: function UpdateFN(context) { var a = context.getAttribute(“firstname”).setValue(“UPDATED”); } Save and … Continue reading Passing Context from a Toolbar Button in Dynamics 365 UCI

Changing Autonumber Prefixes in Dynamics 365

In Dynamics 365, there are some entities which use auto-number prefixes that can be configured. These entities are: Contracts Cases Articles Quotes Orders Invoices Campaigns Categories Knowledge Articles To configure this, go to Setting->Administration and click on Auto-Numbering: Here you will see tabs for each of the options: Let’s look at Orders. The next number is ORD-1002- and then a set of 6 characters. The suffix is used to guarantee … Continue reading Changing Autonumber Prefixes in Dynamics 365

Using formContext in Dynamics 365

In Dynamics 365, the formContext provides a reference to a form or form item through JavaScript. The formContext is part of executionContext, and replaces Xrm.Page which is deprecated in version 9+ of Dynamics 365. The form context object model looks like: Let’s go through an example of using the formContext. Let’s add a script to a form when the form loads, for example, a Contact entity form. Let’s add a … Continue reading Using formContext in Dynamics 365

Dynamics 365 Plugin Registration Input string Was Not in a Correct Format Error

In this post, we will look at when happens when you get the error “An unexpected error occurred. —> System.FormatException: Input string was not in a correct format.”. You may have created a plugin using Visual Studio, and signed and compiled it. You then import it into the Plugin Registration Tool and you get this error (you can copy it into Notepad if you can’t see it in this UI): … Continue reading Dynamics 365 Plugin Registration Input string Was Not in a Correct Format Error

Hiding the Plus Button on a Subgrid in Dynamics 365

In Dynamics 365, on subgrids there is a plus button which can be used to add records. In some cases, you may want to hide this button from users. For example, let’s say on the Account form you would like to hide the + button on the Contacts subgrid: To do this, we can use the Ribbon Workbench application. Let’s first create a new solution and add the Contact entity … Continue reading Hiding the Plus Button on a Subgrid in Dynamics 365

Register a Function OnLoad of a SubGrid in Dynamics 365 Power Apps

In this post, we will show how to register a function that runs on the loading of a subgrid in Dynamics 365. Consider the Contacts subgrid, of which the control is called “Contacts”: We can write code to get the control below using the formContext: var subgrid = formContext.getControl(“Contacts”); Now, in order to add a function, we use the addOnLoad method. Let’s add a function on the fly here: subgrid.addOnLoad(function() … Continue reading Register a Function OnLoad of a SubGrid in Dynamics 365 Power Apps

Filtering Subgrids in Dynamics 365 Power Apps with setFilterXml

Subgrids in Dynamics 365 allow us to do several things with JavaScript. In this post, we will look at filtering a subgrid using setFilterXml. Note this appears to be an unsupported method, please check the Microsoft documentation to see if this becomes supported. Let’s look at the Contacts subgrid on the Account entity: Note the Contacts subgrid is called Contacts: The subgrid is a control, and we can get it … Continue reading Filtering Subgrids in Dynamics 365 Power Apps with setFilterXml

Office 365 and Dynamics 365 Data Center Locations

To view where Office 365 and Dynamics 365 Data Centers are located, go to http://o365datacentermap.azurewebsites.net/: Select your region, for example, North America: Note there is an updated link to https://products.office.com/en-US/where-is-your-data-located?ms.officeurl=datamaps&geo=All: Select your location or Geo: For the US: