Category Archives: Microsoft Dynamics CRM 2013

What you need to know about upgrading CRM 2013 to CRM 2015

Microsoft has released some useful information about upgrading from Dynamics CRM 2013 to Dynamics CRM 2015.


Fix Incorrectly Created Status Reasons in Dynamics CRM

The Status Reason field in Dynamics CRM is a special field which allows you to provide reasons for the status of a particular record. For example, an Article can have a Status of “Active” and a Status Reason of “Awaiting Review”, “Approved”, “Published” etc. Likewise, an Article can have a Status of “Inactive” and a Status Reason of “Expired” or “Deleted”. But what happens if you configure your Status Reasons incorrectly?

I had recently made a mistake while configuring the Status Reason field such that a user could set an Article to Active – Deleted, which was not the desired functionality. The “Deleted” status reason should instead be linked to the “Inactive” state.


The CRM implementation also enforced strict rules so that the “Deleted” status reason must have an ordinal value of 213,940,003. Let’s see what happens when I try to simply re-create the “Deleted” status reason against the “Inactive” state.

If I try to delete and re-create the “Deleted” status reason, the CRM platform automatically assigns it the next available ordinal value of 213,940,006 and it appears that I cannot change this value.


Thankfully there is a way to change this value without any nasty database hacks.

Firstly, remove the “Deleted” status reason, save your changes and publish customizations. Next, add the “Deleted” status reason to the list of “Inactive” status’ as we previously attempted.


On the Add List Value screen, press F12 to launch Internet Explorer Developer tools.


Make sure the HTML tab is selected and then select the cursor icon.


Back on the Add List Value screen, hover over the Value textbox so it appears with a blue outline and then click the mouse.


Back on the Internet Explorer Developer Tools screen, on the right-hand pane, select Attributes and then select the disabled attribute. Press the delete button to remove this attribute.


The Value field will now be editable. Change the value from 213,940,006 to 213,940,003 and then click on OK.


Save the changes to the Status Reason field and publish customisations. The “Deleted” status reason will now be available to select when making records inactive.

CRM 2013 – Asynchronous Solution Import

The new Dynamics CRM 2013 SDK includes a new method to execute service requests asynchronously which currently only works for asynchronous solution imports at the time of this writing. The main benefit of an asynchronous solution import is that there is less of an effect on users who are interacting with the system when the solution is being imported. Previously, users would get locked out and would experience a SQL Server error during import.

The following code snippet can be used to execute an asynchronous solution import in CRM 2013.

var connection = new CrmConnection("Crm");

var service = new OrganizationService(connection);

var context = new CrmOrganizationServiceContext(connection);

IOrganizationService sdk = (IOrganizationService)context;

ExecuteAsyncRequest request = new ExecuteAsyncRequest


Request = new ImportSolutionRequest


CustomizationFile = File.ReadAllBytes(pathToSolutionFile),

PublishWorkflows = true,



ExecuteAsyncResponse response = (ExecuteAsyncResponse)sdk.Execute(request);


CRM 2013 – JavaScript Alerts and Confirmations

The Xrm.Utility library in Dynamics CRM 2013 provides new functions to display alerts and confirmations in CRM forms. In previous versions of CRM, you would have to use the alert() and confirm() JavaScript functions, but these are now supported in the CRM 2013 SDK with some additional options.


This function takes in two parameters:

message: The message you wish to display in the alert.

onCloseCallBack: A function to execute when the user clicks on OK or closes the alert window using the X button.


The following code will display an alert and then will set the First Name field of a Contact to “Frosty” when the user clicks on OK.

CRM2013.showAlert = function () {

Xrm.Utility.alertDialog(“This will set the First Name to ‘Frosty'”, function () {







This function takes in three parameters:

message: The message you wish to display in the alert.

yesCloseCallback: A function to execute when the user clicks on Yes.

noCloseCallback: A function to execute when the user clicks on Cancel.


The following code will prompt the user to confirm if they want to save the form. If they select Yes, the form will save. If they select Cancel, the Email Address field will have focus set.

CRM2013.showConfirmation = function () {

Xrm.Utility.confirmDialog(“Are you sure you want to save this record?”,

function () {;


function () {





It is great to see native JavaScript functions being added to the Dynamics CRM 2013 SDK. This means that you can still achieve the same functionality but in a totally supported manner.

CRM 2013 – Toggle Time Portion of Date Fields

The Xrm.Page.ui.control namespace of the Microsoft Dynamics CRM 2013 SDK provides a new function to programmatically show or hide the time portion of a Date and Time field in a supported manner. Here’s how!

To show both the date and time portion of a Date and Time field:



To hide only the time portion of a Date and Time field:



Unfortunately, there are no SDK functions to allow you to show only the time portion of a Date and Time field, however you can achieve this using unsupported customizations.