{New Tool}JavaScript Dependency Checker for Dynamics CRM 2011/2013

JavaScript Dependency Checker for Dynamics CRM 2011/2013

JavaScript Dependency Checker for Dynamics CRM 2011/Dynamics CRM 2013 is utility for all CRM administrators, consultants who have to deal with JavaScript issues

on CRM 2011/CRM 2013 and want a quick way to document scripts. It is also very useful during product upgrades. 

Refer following link: https://jscriptdependencycheckerdynamicscrm.codeplex.com/

Please share your feedback with me. Hope it helps!

clip_image002

{Error Resolution} Adding Security role for multiple users for Dynamics CRM 2011/2013

We landed in a situation recently where one security role was missing from all users of a business unit. I found the following way of quickly assigning it to all users:

Go to Settings-> Business Units-> Teams-> Open the default business unit team

clip_image002

Open the Business unit and assign the security role to this team:

clip_image004

Hope it helps!

Forcing document mode compatibility for IE: ASP.NET application talking to CRM 2013

Recently we faced an issue on ASP.NET application talking to CRM 2013, where document mode was always needed to be set to IE 9 in order for the UI elements and website controls to work properly. So, was digging on it and found the following way of doing it, add this to web.config:

<system.webServer>

<httpProtocol>

<customHeaders>

<clear />

<add name=”X-UA-Compatible” value=”IE=9″ />

</customHeaders>

</httpProtocol>

</system.webServer>

Following are possible values (referred from MSDN):

X-UA-Compatible value

Document modes

IE=5

Quirks mode

IE=7

IE7 mode

IE=8

IE8 mode

IE=9

IE9 mode

IE=10

IE10 mode

IE=11

IE11 mode

IE=edge

The highest supported document mode of the browser

IE=EmulateIE7

IE7 mode (if a valid <!DOCTYPE> declaration is present)

Quirks mode (otherwise)

IE=EmulateIE8

IE8 mode (if a valid <!DOCTYPE> declaration is present)

Quirks mode (otherwise)

IE=EmulateIE9

IE9 mode (if a valid <!DOCTYPE> declaration is present)

Quirks mode (otherwise)

IE=EmulateIE10

IE10 mode (if a valid <!DOCTYPE> declaration is present)

Quirks mode (otherwise)

IE=EmulateIE11

IE11 mode (if a valid <!DOCTYPE> declaration is present)

Quirks mode (otherwise)

Hope it helps!

{Tips and Tricks}Show/Hide Business Process Flow in CRM 2013 Form

Often, there is a case on CRM 2013 form, when we want to utilize the UI area for viewing details and have an ability to show/hide business process flow area:

Taking example of Sample opportunity Business process flow here:

clip_image002

We can click the arrow like this and the business process flow area collapses:

clip_image004

This is how it finally seems:

clip_image006

What if now I want to even hide this stuff and use the entire area? Something like(I am clicking the checkbox here on the form):

clip_image008

clip_image010

And when I move away from the checkbox:

clip_image012

The good fact about this approach is that if value of checkbox is saved, It is kind of sticky form view if checked on form load along with on change events. Now, the script:

function showHideBusinessProcessFlow()

{    if (Xrm.Page.getAttribute(“new_showbusinessprocessflow”).getValue() == true)

    {       $(“#header_process_d”).css(“display”, “block”);    }

    else    {           

  $(“#header_process_d”).css(“display”, “none”);

    }

}

Note: This is unsupported script and might break with future Microsoft updates.

Hope it helps!

{Tips and Tricks} Configurable Console Application Batch Jobs for Dynamics CRM 2011\2013

Often we keep getting requirements to do one time update or to schedule an update on some entities and the criteria for updating the set of entities is not sure. So, I wanted to devise a configurable way of doing it. The way is to have a personal view, share it with client and utilize it for fetching the entities. Following function block takes a personal view name as input and returns you the Entity Collection:

/// <summary>

/// Fetches the view collection.

/// </summary>

/// <param name=”service”>The service.</param>

/// <param name=”viewName”>Name of the view.</param>

/// <returns></returns>

private static EntityCollection FetchViewCollection(IOrganizationService service, string viewName)

{

QueryExpression query = new QueryExpression(“userquery”);

query.ColumnSet = new ColumnSet(true);

query.Criteria.Conditions.Add(new ConditionExpression(“name”, ConditionOperator.Equal, viewName));

EntityCollection viewCollection = service.RetrieveMultiple(query);

if (viewCollection.Entities.Count == 1 && viewCollection.Entities[0].Contains(“fetchxml”))

{

var fetchExpression = new FetchExpression((string)viewCollection.Entities[0].Attributes[“fetchxml”]);

return ((EntityCollection)service.RetrieveMultiple(fetchExpression));

}

else

{

return null;

}

}

Just plug it to start of your console application for batch job and you can make it configurable for updates. Hope it helps!

{Trips and Tricks}Error codes in Dynamics CRM 2013

Often we face issues in plugins and get error codes from CRM while debugging our server side code.

For e.g.

Error code 80048531 means CustomImageAttributeOnlyAllowedOnCustomEntity which is

A custom image attribute can only be added to a custom entity.

Just happened to pass by a cool resource containing the error codes and their descriptions. It is available on following path in CRM 2013 SDK:

SDK\SampleCode\CS\HelperCode

has excel named CrmErrors

Refer to image below:

clip_image002

Hope it helps!