Adding Row Colours to CRM 2013 Sub-Grids dynamically based on value in cells

Sometimes we get requirement to show colour encoding on sub-grid in CRM 2013 forms. One of the

Queries I received was ways to achieve them. Here is a sample of what I tried on Case sub-grid on

Vanilla CRM Account form:


Here is the script:

I have got of lot of feedback to put more details of where to put scripts and stuff, so here it goes.

Sub-grid name can be found from FORM EDITOR. Refer screen below(Double click the sub-grid will give a property window):


Now the script, Add the below function to form onload

function subGridOnload()
var grid = $(‘#accountcasessgrid’);  //Replace Grid name here
if (grid == null)
// delay one second and try again.
setTimeout(subGridOnload, 1000);

if(grid[0] == undefined)
// delay one second and try again.
setTimeout(subGridOnload, 1000);

if(grid[0].control == undefined)
// delay one second and try again.
setTimeout(subGridOnload, 1000);

if(grid[0].control == null)
// delay one second and try again.
setTimeout(subGridOnload, 1000);

if (grid[0].control.get_totalRecordCount() == -1)
// delay one second and try again.
setTimeout(subGridOnload, 1000);

// logic Replace status names and colours as required

$(‘#accountcasessgrid td’).filter(function() {
return $(this).text() == ‘Resolved’;
}).closest(‘tr’).css(‘background-color’, ‘green’);

$(‘#accountcasessgrid td’).filter(function() {
return $(this).text() == ‘Active’;
}).closest(‘tr’).css(‘background-color’, ‘yellow’);


Hope it helps!

Ask your Query : Click here

Note: It is unsupported way and may break in future if Microsoft changes rendering of sub-grids in a future release.
Trying to Learn Dynamics CRM: Download!

Learn Dynamics CRM App on Google Play store


Ask Your Query on Dynamics CRM here


Any problem in CRM – end user,Microsoft partner or an individual?

Problem Area – Technical, Functional, Training, Development or consulting?

Just leave your message here and I will get back to you:

Hope it helps!


{Step by Step}Turning Tracing on for IIS on Windows Server 2012

I recently needed to enable tracing on IIS for Windows Server 2012 and thought its worthwhile to share for others.

· Go to Server Manager and Click Manager(Top Right corner):


· Pick Manage and Add Roles and Features:


· Click Next on below screen:


· Pick first option as below screen:


· Choose server on below screen and click Next:


· On Next screen expand Web Server:


· Pick Tracing as shown in below screen, Click Next:


· Click Next on the below screen:


· Click Install on below screen(Tick Restart checkbox if needed):


· Click Close once Installation is complete:


You are done. Hope it helps!

Using CRM 2013 Dashboard to show Live Traffic of Company Website

In current scenario of e-tailers (companies selling online), there are tons of things out there to listen to who is visiting the company page.

But what if someone wants to see live feed of Traffic visiting the company site?

Here is what I tried for my blog:


Yes, this is working from CRM 2013 Online dashboard. Now the question is how?

Well, first we need to get a URL to embed on company website from providers like FEEDJIT fairly simple.

Embed it on website to be tracked.

Now, how to show it on dashboard?

That is fairly simple, take a Web resource with following code:


<title>Live Feed</title>

<style type=”text/css”>

html, body {

border: none;


overflow-y: hidden;

overflow-x: hidden;



<meta charset=”utf-8″></head>


//IFrame with URL here


The last part is to add web resource to dashboard.

Some more interesting ones:

Embed Bing Search:


Hope it helps!

ERD Generator for Dynamics CRM 2011/2013

ERD Generator for Dynamics CRM 2011/2013 is a Windows Form application that is can be used for Dynamics CRM 2011 or Dynamics CRM 2013:


For CRM 2015, Use following link:

Here is a video to see how this will work:

Just download the above .doc file and rename it to .zip and run the tool.

This tool allows you to build ERD (Entity relationship diagrams) that are dynamically updated based on the published CRM entities and Fields. You can pick a source entity and build ERD around it. It generate a VISIO output but also lets you pick CSV to document Entity relationships.

It generates a CSV having details like:


It generates ERD in VISIO:


Visio legend below:


Hope it helps!

Check this out

{Tips and Tricks} A good practice for configuring views with Lookup in Filter Criteria in Dynamics CRM

We often make Views in Dynamics CRM and move them between environments (Development environment to UAT environment and UAT environment to Production environment). Lookup GUID values need not be same between environments and views then need to be manually changed. A way around this is to configure views with text matching name fields instead of their lookups. In this way Views are not dependent on GUID and can be directly ported between environments. Taking example below, this will have all Contacts with Account name equal XYZ and can easily be moved across environments:


Hope it helps!

{New Scripting reference}Variants of Xrm.Utility.openEntityForm for Dynamics CRM 2013

Xrm.Utility.openEntityForm was introduced in new scripting reference from Microsoft.

It has few variants and I only found few blogs for a complete reference for it. Adding my findings here (Reference from MSDN site):

Open a new account record



Open an existing account record



Open a new account record with a specific form and setting default values


var parameters = {};

parameters[“formid”] = “b053a39a-041a-4356-acef-ddf00182762b”;

parameters[“name”] = “Test”;

parameters[“telephone1”] = “(425) 555-1234”;

Xrm.Utility.openEntityForm(“account”, null, parameters);

Now some pointers on few things it can not do:

· Open a new record with setting form values for regardingobjectid will not work. So, in that case, the Workaround? Here we go:

Open Form Script

//set the parameters to pass to the new form
var parameters = {};
var Regarding = Xrm.Page.getAttribute(“regardingobjectid”).getValue();
parameters[“parameter_regardingid”] = Regarding[0].id;
parameters[“parameter_regardingname”] = Regarding[0].name;
parameters[“parameter_regardingtype”] = Regarding[0].entityType;
//Open the new form

onLoad Script for new form which needs to be opened:

// Get the Value of the Regarding through the Customer Parameters
var param=Xrm.Page.context.getQueryStringParameters();
var regardingId=param[“parameter_regardingid”];
var regardingName=param[“parameter_regardingname”];
var regardingType=param[“parameter_regardingtype”];
//Populate the Regarding if there is one
if (regardingId != undefined)
  {Xrm.Page.getAttribute(“regardingobjectid”).setValue([{id:regardingId, name:regardingName, entityType:regardingType}]);}  

· In some cases, it might not work for Lookup attributes on custom entities, there is no official documentation, but an approach similar to one mentioned above will work.

Hope it helps!