Posts Tagged ‘CRM 2015’

Incorrect date (KPI) calculation – Enhanced SLA

September 28, 2015 Leave a comment

We have an ‘Enhanced SLA’ configured in our CRM application which was working fine in development environment.

Recently we deployed solution on Customer’s server and surprisingly SLA showing incorrect First Response\Resolve by KPI’s hence ‘SLA Counter’ showing wrong timer.

Refer below screen where Timer showing 561 days however ‘Failure Date’ was after 3 days.
Incorrect SLA Counter

Incorrect SLA Counter


  • Looks like its product issue with date calculations for non US based servers.
  • In simple terms if your CRM Application Server’s Region is Non-Us you might get wrong date calculations.
  • My customer is non-Us based and all the servers ‘Region’ settings set to their country which causing the issue.


  • In my case changing CRM Site Globalization culture to English (United States) (en-US) solved the issue.
  • Follow below steps
    • Open IIS
    • Select ‘Microsoft Dynamics CRM’ website
    • Double click on ‘.NET Globalization’ feature
    • Set ‘Culture’ and ‘UI Culture’ to ‘English (United States) (en-US)
CRM Website- Net Globalization

CRM Website – Net Globalization

  • Reset the IIS

Refer this article for more details


Why my Enhanced SLA not triggering – CRM 2015

August 29, 2015 1 comment

I was exploring ‘Enhanced SLA’ feature in CRM 2015. I created my first basic enhanced SLA with below steps

  • Created a new SLA
Enhanced SLA

Enhanced SLA

  • Added a new ‘SLA Item’ with no ‘Applicable When’ criteria (i.e., SLA should kick in for all Case’s if no criteria given) and ‘Success Criteria’ as Case Status ‘Resolved’
Applicable And Success Criteria

Applicable And Success Criteria

  • Set the Failure Duration as ‘5 minutes’ and Warn Duration as ‘1 Minute’


  • Activated the SLA
Enhanced SLA - Activation

Enhanced SLA – Activation

  • Created a new Case.
  • But no Timer or ‘SLA KPI’ records logged when I expanded ‘Enhanced SLA Details’ section.
Enhanced SLA Details

Enhanced SLA Details


  • There was no ‘Entitlement’ configured
  • So what is an Entitlement?  ‘Entitlements’ are correlated to Customers (i.e., Either Account or Contact) in the system and define what kind of support your customers are eligible for.

Enhanced SLA – Entitlements

Note : If you don’t want to configure ‘Entitlement’ make to set SLA as Default which will be applicable for all Customers.


  • Since I am just exploring SLA’s, I did not create an ‘Entitlement’ instead I made my SLA as ‘Default’
Enhanced SLA - Set Default

Enhanced SLA – Set Default

  • Created a new Case and this time got the OOB Timer and SLA KPI record in sub-grid.
Enhanced SLA - Triggered

Enhanced SLA – Triggered

Additional Details

  • How to Pause a SLA
    • Using ‘Enhanced SLA’ you can put SLA on ‘HOLD’ by choosing Case ‘Status’ with pre-configured ‘Case Status’ (Refer screen how to configure Status)
    Enhanced SLA - Set 'HOLD' status

    Enhanced SLA – Set ‘HOLD’ status

    • Go to the ‘Case’ and choose Status = ‘On hold’ and Save
    Case - Choose 'On Hold' status

    Case – Choose ‘On Hold’ status

    • See the Resolve in set to ‘Paused’
Enhanced SLA - Case 'On Hold'

Enhanced SLA – Case ‘On Hold’


‘Xrm’ does not exist in namespace ‘Microsoft’ – Build error while referring CRM 2015 SDK Dll’s

I got below annoying build error while adding early binding class to my Plug-in Project and build.

XRM does not exist in namespace

XRM does not exist in namespace

It was bit strange as I already referred ‘Microsoft.XRM.SDK.dll’ from CRM 2015 SDK.

Reason :

  • CRM 2015 SDK has built on .Net 4.5.2 Framework and my Visual studio does not support 4.5.2


Application Target Framework

Application Target Framework


Connecting to CRM from other applications using CrmConnection class – CRM 2015

Assume that you have an ASP.Net web application and you want to retrieve Contacts from CRM and display in a grid.

Before CRM 2015, to establish a connection with CRM we need to create a service proxy with user credentials (Refer article).

With CRM 2015, we can use “Connection Strings” to connect to the CRM server from external application.

You define the CRM connection strings in <web.config> or <app.config> as below



    <!– Online using Office 365 –>

<!– <add name=”Server=CRM Online, organization=contoso, user=someone” connectionString=”Url=;; Password=password;”/> –>

    <!– Online using Microsoft account (formerly Windows Live ID) –>

<!– <add name=”Server=CRM Online, organization=contoso,” connectionString=”Url=;; Password=password; DeviceID= DevicePassword= “/>–>

    <!– On-premises with provided user credentials –>

<!– <add name=”Server=myserver, organization=AdventureWorksCycle, user=administrator” connectionString=”Url=http://myserver/AdventureWorksCycle; Domain=mydomain; Username=administrator; Password=password;”/> –>

    <!– On-premises using Windows integrated security –>

<!–<add name=”Server=myserver, organization=AdventureWorksCycle” connectionString=”Url=http://myserver/AdventureWorksCycle;”/>–>

    <!– On-premises (IFD) with claims –>

<!–<add name=”, organization=contoso,” connectionString=”Url=;; Password=password;”/>–>



And you can establish connection in your code as below

// ‘CRMOnline’ is ConnectionString name defined in <web.config> or <app.config>

var connection = new CrmConnection(“CRMOnline”);

var service = new OrganizationService(connection);

var context = new CrmOrganizationServiceContext(connection);

Refer MSDN article for more details


Categories: CRM 2015 Tags: ,

CRM 2015 – Useful JScript Snippets and Syntaxes

Below are the list of useful scripts and syntax’s

Filter look up records

Let’s consider a scenario, “Primary Contact” lookup on Account form should display only Contacts with “Business Phone” (i.e., Contact.telephone1 != Null)

Steps :

  • Add PreSearch event for ‘Primary Contact’ lookup
  • In the event handler define Filter and set to the lookup using ‘addCustomFilter’ method


// Attach below ‘onload’ function to Form onload event

function onload() {



function filterCustomerContacts() {

//Only show Contacts with ‘Business Phone’

var primaryContactFilter = “<filter type=’and’><condition attribute=’telephone1′ operator=’not-null’ /></filter>”;

Xrm.Page.getControl(“primarycontactid”).addCustomFilter(primaryContactFilter, “contact”);


Filter Primary Contact Lookup

Filter Primary Contact Lookup

Get fields of specific types

One of my blog follower asked this question “How to get list of all Option Set fields placed on the form?”.

Below is the Script to get Attributes based on Type or Requirement Level using “”


function onload() {

var requiredAttributeNames = [];

var optionsetAttributeNames = [];

function (attribute, index) {

if (attribute.getRequiredLevel() == “required”) {



if (attribute.getAttributeType() == “optionset”) {




alert(“Required Attributes on the form are : ” + requiredAttributeNames.join());

alert(“Attributes of Type Optionset on the form are : ” + optionsetAttributeNames.join());


Callback functions on Save

Saves the record asynchronously with the option to set callback functions to be executed after the save operation is completed.

Script, errorCallback);

successCallback() {

alert(“Form saved !!!”);


function errorCallback(saveErrorResponse) {

if (saveErrorResponse != null) {

if (saveErrorResponse.message != ‘undefined’ && saveErrorResponse.message != null) {

alert(“Error on Save – ” + saveErrorResponse.message);




Get control placed on Header

  • var nameControlInHeader = Xrm.Page.getControl(“header_{fieldname}”);

Get control placed in business process flow

  • var nameControlInBPF = Xrm.Page.getControl(“header_process_{fieldname}”);
  • We can get controls in the active stage.

Hide\Show time portion of Date Control

  • Page.getControl(“createdon”).setShowTime(true/false);


  • getUserPrivilege – When field level security has been applied to an attribute, determine whether a user has privileges to perform create, read, or update operations on the attribute


  • getMin – Get the minimum allowed value for an attribute that contains a number


  • getMax – Get the maximum allowed value for an attribute that contains a number


  • getIsPartyList – Determines whether an attribute is a partylist.


  • getAttributeType – Get the type of attribute (i.e., Option set,Text etc…)


  • getFormat- Get attribute’s format. (i.e., Text,URL,Email etc…)


  • getInitialValue – Get the initial value of a Boolean or Optionset attribute


  • getMaxLength – Get the maximum allowed length for an attribute that contains a string


  • alertDialog – Display a non-blocking alert dialog with a callback function.

var alertDisplayed = false;
“Showing Alert”,
function () { alertDisplayed = true; }

  • confirmDialog – Display a Non-blocking Confirm dialog with different callbacks depending on the button clicked by the user.

var agree = false;
“Do you agree?”,
function () { agree = true;},
function () { agree = false; }


Categories: CRM 2015 Tags: ,

CRM 2015 Online Update 1 – Application and Customization changes

In this article I am going to brief about new changes and updates in CRM 2015 online update 1.

Trigger Custom Action from Workflow or Dialog

  • We can invoke a custom action directly from within a workflow or a dialog.
Trigger Custom Action from Workflow

Trigger Custom Action from Workflow

Steps on how to Create and Invoke Custom Action from Workflow

Validate Required Steps in Business Process Flow

  • System will now validate all the required steps in Business Process before moving to next stage.
  • Before Update 1 its possible to bypass validation using SDK calls.
Validate Required Steps BPF

Validate Required Steps BPF

Clear field values with business rules

  • Business rules now let us clear field values, on the client and server
Clear Field Values Business Rules

Clear Field Values Business Rules

Business Process Flow – Move back to previous Stage

  • We can go back to the previous stage in the business process flow regardless of entity type
  • You can choose desired previous stage and click ‘Set Active’.
BPF Cant move to Previous stage - Before Update 1

Cant move to Previous stage before Update 1

BPF Choose Previous Stage and Set Active

With Update choose Previous Stage and Set Active

Date and Time field new behavior

  • We got two new time zone independent behaviors for the Date and Time data type (Date Only and Time Zone Independent).
  • Below are different Formats and Examples.
Date Field Formats

Date Field Formats

Date Field Changes Examples

Date Field Changes Examples

Calculated and Rollup Fields

  • With new updates to Calculated fields we can compute the difference between the two dates by using new built-in functions
  • Note that “Now” operator gives SQL Server Time in UTC not Local System Time.
Calculated and Rollup Fields

Calculated and Rollup Fields

Global Most Recently Used (MRU)

  • With Global MRU, provided an access to most recently viewed records (up to 30 records).
Global MRU

Global MRU

Global MRU Storage

Global MRU Storage

“Older Than X” Enhancements in Advanced Find

  • We can now filter on additional units of time including minutes, hours, days, weeks, and years.
  • The Older Than X clauses can be used with Advanced Find, the saved view editor, and queries that are based on FetchXML.
Advanced Find Older Than Operator

Advanced Find Older Than Operator

Navigation and Themes

Plug-in Trace Logs

  • System administrators and developers can now configure CRM to write trace logs to a new CRM entity – ‘Plug-in Trace Log’.
  • These logs can then be viewed within the CRM web application, also from Advanced Find.
  • We cannot extend the “Plug-in Trace Log entity”. We can only view or delete records of the entity.
  • By default, permission to view the logs is enabled for System Administrators and System Customizers, but can be granted to other users
  • Enabling Activity Tracing
    • We can enable\disable from Settings -> Administration -> System Settings -> Customization
    • Enable Plug-in trace log

      Enable Plug-in trace log

    • The setting provides the following options:
      • Off
      • Exceptions – log messages only if an exception is encountered in the execution pipeline
      • All – log all messages, even if there was no exception.

How is “Plug-in Trace Logs” different from developers logging in to their own custom entity?

  • The problem with writing logs to our own Custom entity is due to the fact plug-ins execute in transaction and the transaction is rolled back whenever an exception occurs anywhere in the event pipeline. As a result, the records written to the custom entity would also be rolled back.
  • And with new ‘Plug-in Trace Logs’ entity, the messages are logged even if an exception is encountered and the rest of the transaction is rolled back



CRM 2015 – Navigation and Themes

With the advent of CRM Online 2015 Update 1, we got much awaited New Navigation Bar pattern (Vertical Stacked Menu) and Themes. New Navigation Bar –

CRM 2015 - Navigation Bar

CRM 2015 – Navigation Bar

Themes –

  • With Themes, We can create a custom look and feel, to our CRM web application.We can change CRM applications
    • Logo
    • Navigation bar color
    • Header color
    • Default entity color
    • Default Custom entity color
    • Control Shade & Border
  • We can define multiple themes, but only one can be set and published as the default theme.
  • The theme customization is supported in Microsoft Dynamics CRM for Outlook
  • To create a new Theme, Navigate to Settings -> Customizations -> Themes
CRM 2015 - Themes

CRM 2015 – Themes

  • We can create your own theme and Publish (Once published, Theme propagates to all Users)
CRM 2015 - Themes (Preview_Publish_Clone)

CRM 2015 – Themes (Preview\Publish\Clone)

  • You can Clone new Theme from existing Theme and Preview
  • “Preview Theme”, sets a cookie in browser allows us to use theme until either you exit the preview or delete cookies.

Below is sample theme I created, I added my own Jpg web resource as ‘Logo’ and got color hexadecimal codes from Color Hex site

CRM 2015 - New Theme

CRM 2015 – New Theme

Deploying Themes across Organizations

  • We cannot include ‘Theme’ in CRM Solutions as Theme is not solution aware.
  • However, you can export the Theme and import it to target solution.
  • The imported theme must be published to take an effect
CRM 2015 - Export Theme

CRM 2015 – Export Theme

Theme Best Practices

Theme Best Practices

Theme Best Practices

Changing Specific Entity Color

  • We can change the color of desired entity in Entity Definition
CRM 2015 - Set Color Of Entity

CRM 2015 – Set Color Of Entity

CRM 2015 - Account Entity Changed to Green

CRM 2015 – Account Entity Changed to Green

CRM 2015 - Set Color Of Entity Limitations

CRM 2015 – Set Color Of Entity Limitations

Refer MSDN Article for more details. 🙂

Categories: CRM 2015 Tags: , ,