Dynamics 365 $ is not defined

In your JavaScript code, you may receive this error when running jQuery code: $ is not defined To resolve this, add the following code to JavaScript before the jQuery call is made: if (typeof($) === ‘undefined’) { $ = parent.$; jQuery = parent.jQuery; }

Create WCF Web Service in Visual Studio

Windows Communication Foundation (WCF) web services can be created in Visual Studio. Note these web services replace the old asmx web services. To create a web service in Visual Studio do the following. Create a new project in Visual Studio and select WCF Service Application: This creates the solution: Delete the existing Service1.svc and IService1.cs and add a new WCF Service: This will create these 2 files again. Note the … Continue reading Create WCF Web Service in Visual Studio

Dynamics 365 Accessing the Plugin Trace Log

The Dynamics 365 Plugin Trace Log settings are located in Settings->Administration->System Settings: And then accessed under the Settings->Customization menu: Records will be created here: And you can drill into each record for more details: Click here to learn how to write to the Plugin Trace Log from your plugins.

Dynamics 365 Raise Error in Plugin

To raise an error in the plugin code, we use InvalidPluginExecutionException. For example: throw new InvalidPluginExecutionException(“Plugin has run. Code will stop executing.”); The code runs in the Execute function of the plugin code. For example: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; namespace Carl.AssociateDisassociate {     public class AssociateDisassociate : IPlugin     {         public void Execute(IServiceProvider serviceProvider)         {             throw new InvalidPluginExecutionException(“Plugin has run. Code will stop executing.”);         }     } } The code will display the error and stop executing: If you register the code on the Pre-Operation it will prevent the rest of the CRM code from … Continue reading Dynamics 365 Raise Error in Plugin

Dynamics 365 – Xrm.Page.data.refresh and Xrm.Page.data.save

Dynamics 365 has a couple of JavaScript functions that are useful in refreshing and saving pages – xrm.page.data.refresh and xrm.page.data.save. We will go though examples of using these. The refresh function is defined as: Xrm.Page.data.refresh(save).then(successCallback, errorCallback); We can pass an optional save boolean as well. For the purpose of the demo, let’s say when tabbing off the Account’s website field, we want to refresh the current page. Our code: function RunJavaScript() … Continue reading Dynamics 365 – Xrm.Page.data.refresh and Xrm.Page.data.save

Powershell Cmdlets for Dynamics CRM On-Premise

To use the cmdlets for Dynamics CRM On-Premise, do the following. Go to the server running the Full Server role for Dynamics CRM. Type in: Add-PSSnapin Microsoft.Crm.PowerShell You can now run CRM commands. Type in: Get-Help *Crm* CRM will return help information on its commands: You can then run individual commands, for example, it you want to see CRM settings, you can run a command to get a particular setting. … Continue reading Powershell Cmdlets for Dynamics CRM On-Premise

Power BI – DAX – RELATED

Power BI has a RELATED function that allows you to get data from a related table. Let’s go through an example. We have 2 tables: Goals, which holds salesperson’s goals Sales, which holds sales transactions The tables have a relationship of the common field Salesperson. Now, let’s say we want a field in the Sales table which is the Goal field from the Goals table. To do this, create a … Continue reading Power BI – DAX – RELATED

Getting and Setting a Dynamics CRM Field in JavaScript

To get and set a Dynamics 365 field, first find out the field name. Open the form and find the field, for example on the leads form, the topic: Double click the field and see what the Name is, in this case “subject”:   function UpdateField() { var s = Xrm.Page.getAttribute(“subject”).getValue(); alert(s); Xrm.Page.getAttribute(“subject”).setValue(“Hello World”); var s = Xrm.Page.getAttribute(“subject”).getValue(); alert(s); } When this runs we see first the original topic: Then … Continue reading Getting and Setting a Dynamics CRM Field in JavaScript

Dynamics 365 Business Rules

Business Rules are a way in Dynamics 365 to add actions to events that occur in the user interface. Let’s go through an example with the Leads form. Select Business Rules from the navigation bar and then New Business Rule: This will open a blank template. Let’s add a condition that if the City = “New York”, then lock the description field. Click Activate: As soon as the City is set, the … Continue reading Dynamics 365 Business Rules

Dynamics 365 Troubleshooting User Access

There are times when users will not have access to resources in Dynamics 365 when they should. Dynamics 365 will throw an error based on the type of denied access. Generally, these access errors can be resolved by determining what the resource is the user is trying to access and then granting the user access to the resource through an security role. For example, if a user wants to assign a security role … Continue reading Dynamics 365 Troubleshooting User Access