Category Archives: JavaScript

Error Qualifying Lead in Dynamics 365 Customer Engagement

Issue: When qualifying a lead in CRM, we receive the following error message. “Unable to get property ‘getUserPrivilege’ of undefined or null reference Script” Reason: This was a customized system and we noticed the Company and Title field were missing from the lead form. Solution: Add the fields back on the form, and if required… Read More »

Resolve $ undefined error for CRM HTML web resource

It is a common requirement to integrate HTML web resource in CRM form or open an HTML web resource as a separate window to have the additional user interface. JQuery library is a common library to perform the script related operation and even to deal with HTML controls in such scenarios. Sometimes we receive error… Read More »

Modify OOB ribbon button for Specific Activity Type Entity

Introduction: We recently had a business requirement where we wanted to hide the ‘Mark Complete’ OOB button from the home page of Activity entity. However, we wanted to hide this button for Service Activity entity and not for other activity types like Task, Appointment, Email, etc. ‘Mark Complete’ is a button on the Home Page… Read More »

Hide Add Button on a Subgrid by Applying Custom JavaScript Rule

Recently we came across a scenario where we needed to show and hide the subgrid add button on satisfaction of a certain condition. We had to take the help of Ribbon Workbench to achieve the same. Working: Install Ribbon workbench in your Dynamics CRM/365. Create a solution with the entity whose subgrid button you want… Read More »

Execute the Global Action Using Web API in Dynamics CRM

Introduction: We have already discussed how to perform entity specific custom action using Web API in one of our earlier blog. But when we want an action to be performed on multiple entities, we need to create a global action. Create global action:- Go to Settings → Processes → Click New then select category as “Action” and entity… Read More »

Retrieve, Update and Delete Record Using Alternate Key in Dynamics CRM Web API

Before Alternate key concept was introduced in Dynamics CRM it used to be the only GUID of the record which was used to retrieve, update or delete any record. Hence we had to get the record GUID first for any retrieve, update or delete operation. But with the introduction of Alternate keys concept this overhead… Read More »

Deep Linking for Dynamics CRM Tablet Client

Introduction With Dynamics CRM Tablet client now supporting web resource on tablet client, it is now also possible to open the CRM record through a hyperlink in the web resource. It has been a common requirement that the custom web resources have the need to provide a link to the actual records being displayed. Until… Read More »

Tricks to Resolve Common Scripting Errors on Dynamics CRM Mobile Forms

Introduction: There are some common mistakes which we do while scripting which forms an error on Dynamics CRM mobile forms. For instance, while adding ribbon buttons on the form there are possibilities of mistakes made by us which does not form an error on Web form but we can get an error on Mobile form.… Read More »

Execute Web API request using Angular JS in Dynamics CRM

Introduction In our earlier blogs of  Web API introduced in Dynamics CRM 2016, we have explained different requests and functions of Web API to querying and performing operations in Dynamics CRM. This blog will show you how to execute Web API request using Angular JS. This article would be helpful for those who have knowledge of… Read More »

Execute fetchxml using Web API in Dynamics CRM 2016

Introduction Microsoft Dynamics CRM Online 2016 Update and Microsoft Dynamics CRM 2016 (on-premises) introduced new concept called The Web API. It can be used across a wide variety of programming languages, platforms, and devices. The Web API implements the OData (Open Data Protocol), version 4.0, an OASIS standard for building and consuming Restful APIs. Basically… Read More »

Design Auto Complete Text controls in Dynamics CRM 2016

Introduction: On Dec 1st Microsoft released another great version of Dynamics CRM – CRM 2016 that has loads of new features and not to forget developer enhancements too. One of the developer enhancements added to Dynamics CRM 2016 is “Auto Complete” which allows us to provide auto complete feature for the single line text fields.… Read More »

Identify the trigger for an On-load event for Sub-grid in Dynamics CRM

Introduction: With CRM 2015 SP1, the Client API was extended to allow attaching events to sub-grid to manage the sub-grid data/operations. The OnLoad event however executes on all of the following operations Load of parent form. Save of parent form. Add a new record in sub-grid Remove a record from sub-grid Navigating to prev/next page… Read More »

API functions to control Subgrid behavior starting Dynamics CRM 2015 Update 1

Introduction: Prior to CRM2015 update 1 the only available function for interacting with the subgrids on the form was refresh(). This function is used to refresh the sub-grid records. With the release of CRM 2015 update 1, more functions were introduced to interact with the sub-grid using JavaScript. Function list: 1. addOnLoad 2. removeOnLoad Use… Read More »

Make Cross Domain Web Service Request through Client Side Scripting in Dynamics CRM

To perform CRUD operations with CRM data at client side we use ODATA and SOAP services of Microsoft Dynamics CRM. We use XMLHttpRequest to send request to these services to get the response. Microsoft Dynamics CRM provides below WCF services that we used to manipulate CRM data, Organization Data Service – Protocol:  OData (REST) http://<server>/XRMServices/2011/OrganizationData.svc/… Read More »

Passing special characters For Odata request using JavaScript in Dynamics CRM 2015

To retrieve records from Dynamics CRM using JavaScript one of the popular options is using CRM Odata services using REST endpoint. There are many situations occurs when we need to retrieve records from CRM by name using REST retrieve multiple request. For example in below script we are retrieving products by product name. While passing… Read More »

Lock/Unlock Composite fields using Java Script in Dynamics CRM

Traditionally we use the following way to lock or unlock the fields programmatically, Xrm.Page.getControl(fieldname).setDisabled(true/false); But there could be some cases where we would need to lock/unlock the composite fields programmatically. For example, consider the following scenario, Suppose that we are populating the Bill To address on Quote as the address of the customer selected on… Read More »