Changing SharePoint DateTimeControl Control DateFormat to DD/MM/YYYY

Samim khan

Recently I faced a problem while using SharePoint DateTimeControl in visual WebPart although the Culture of the site was set to ‘en-gb’ the SharePoint DateTimeControl was still showing the DateTime in the ‘MM/DD/YYYY’ Format. After some googling I found that I shall have to change th LocaleId of the control as well

To change the Date Format of SharePoint DateTimeControl  to ‘DD/MM/YYYY’ add LocaleId=”2057″


<SharePoint:DateTimeControl ID=”dtStartDate” CssClassTextBox=”DateControlformfield” runat=”server” DateOnly=”True”         IsRequiredField=”True” LocaleId=”2057″ />

Or to find more LocaleId appropriate to your requirement please see the below link

View original post

Security Roles and Teams in CRM 2011 – An Inconvenient Half-Truth


Over the course of the last two years or so reading everything I can about Dynamics CRM 2011, as well as teaching many classes of people how to get the most out of their CRM systems, one thing which comes up again and again is how to best structure Business Units, Users and Security Roles, and sometimes Teams as well to get the exact model you want to match your business requirements for who has access to which records and when.

Users inherit Security Roles from Teams – right?

One concept I have seen repeated many times is that “Users inherit security roles from all the Teams they are in”. And generally this seems to be a reasonable way to describe how it works, but occasionally odd behaviours seem to show up which make this appear to be less than 100% accurate.

I also had a gut feeling for…

View original post 5,013 more words

Fixed – CRM Mail Merge button missing in Word 2013.


The way we got it working was to download the following template


From the following location


And place it at the following location


Followed by restarting Word.

The helpful post

Nested Quick Create form in CRM 2015

Nested Quick Create form in CRM 2015

In CRM 2013,

If we click on Create button for Quick Create a record

Say for e.g. Contact record

And want to create a new Account record to be associated to it

We need to click on “Look Up More Records” and then “New”

This opens up the default Contact form


However in CRM 2015,

We have a New Button

It will open the Quick Create Form for the account record instead of the default form as in the case of CRM 2013.

On creating and saving the account record, it will close the Account record and populate the lookup in Contact record

Read Option set Text/Value at one go CRM 2013


Often we have requirement to read option set Text/Value quickly, I wrote a script to quickly read all option sets on a form

Go to Google chrome console(Press F12 in Chrome), select the option Console as per screen, Note that contentIframe0 is selected :


and run following script on your form :

var attributes =;

var optionSetAttributes = ”;
var optionSetValues = ”;
Xrm.Page.ui.controls.forEach(function (control, index) {
if (control.getControlType() == ‘optionset’) {
optionSetValues = ”;
var controlName = “#” + control.getName() + “_i”;
optionSetValues += control.getName() + ” option set values below: nn”;
(function () {
optionSetValues += ‘<div>’ + ‘Value: ‘ + $(this).attr(‘value’) + ‘,Title: ‘ + $(this).attr(‘title’) + ‘</div>’;
optionSetAttributes += ‘<div>’ + optionSetValues + ‘</div>’;

var htmlString = ‘<div style= “overflow:always”>’ + optionSetAttributes + ‘</div>’;

var w =“Surprise”, “#”);
var d =;

You will get following…

View original post 13 more words

JavaScript runtime error: Unable to get property ‘get_code’ of undefined or null reference in CRM

We can get the ‘get_code’ error if we are using Assign Step in Action/Workflow and the value is null for the field selected.

Here we need to use If condition to check if the value exist for that particular field before using Assign Step.

CRM 2013 – Understanding Business Rules

Hosk's Dynamic Blog

What are business rules

Business rules were added to CRM 2013 and a way to provide client side scripting/validating/field or section hiding without having to write any JavaScript.  For context server side customization’s are plugins/workflows (e.g. code written in C# is executed on the server)

Business rules are also known as portable business logic (although I don’t know anyone who calls them that) because they also work on the mobile app.

What can business rules do

  • Set field values
  • Show/hide fields – Visibility
  • Enable/disable fields
  • change the requirement levels on fields (e.g. business required, recommend)
  • Show error messages

All the features above were usually done using Javascript in CRM 2011.

I have written a quick guide to business rules here

Why are business rules useful

Business rules are useful because they allow non developers to provide the functionality mentioned above on forms.  Business rules can be used on Main and…

View original post 1,180 more words

Types of fields in Dynamics CRM 2013

Microsoft Dynamics CRM Blog

As you use fields in your customizations the first thing you need to understand are the types of fields you can create and edit and some of the system fields an entity may have. The following table summarizes field types available in Dynamics CRM 2013.

Field data typeDescription
Single Line of TextUp to 4000 characters of text can be in this field. You can set a maximum length to less than this. This field has several format options that will change the presentation of the text. These options are Email, Text, Text Area, URL and Ticker Symbol and Phone.
For more information check Single line of text format options below.
Multiple Lines of TextUp to 1,048,576 characters of text can be in this field. You can set a maximum length to less than this. When you add this field to the form you can specify the…

View original post 1,247 more words

Sample code: Using jqGrid in ASP.NET page to show CRM data

Sample code: Using jqGrid in ASP.NET page to show CRM data

Just sharing a simple ASP.NET page that uses jqGrid to show contact records in CRM and allows user to search.

Here is the code (remove .doc)

Hope it helps ..

Get current user language in JavaScript in CRM 2011/ CRM 2013/ CRM 2015

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.


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:


Hope it helps!

View original post

Hide Ribbon on SharePoint 2013 using CSS

Share SharePoint Points !

Hi Guys,

I recently experienced the migration from SharePoint 2010 to 2013. I was earlier hiding Ribbon using the SPSecurityTrimmedControl and CSS. But in SP 2013 MS has divided whole ribbon in two section: s4-ribbonrow and suiteBar

Hiding the ribbon is as much as easier as it was in 2010 version. But here we just need to take care of above two mentioned sections. I have gone thorough some of the blogs where people are saying that we have change the html file(Seattle.html or oslo.html) and design manger will take care of creating master page for you (ref: Hide Ribbon).

But there is another traditional way of doing same, follow the given steps:

1) Open the master page file in the SharePoint designer.

2) Add the style tag to hide the ribbon for all the user:

#s4-ribbonrow, #suiteBar { display : none; }

3) Now we have to do…

View original post 59 more words

Field Level Security in CRM 2015

Now supported for System (OOB) Attributes.

Contact’s “Job Title” attribute in CRM 2011

Contact’s “Job Title” attribute in CRM 2015

Can be enabled for email data type attribute

In CRM 2011

In CRM 2015


Address field are also supported.

{Learning} All you might need to know on CRM 2013 App for Tablets


I spent last week or so discovering things on CRM 2013 tablet application and to be honest, it is pretty good. There are limitations but it is a good start for Dynamics CRM in tab and mobile market with having an out of box app.

Here are the series of blogs which pretty much sum all I could find on CRM 2013 Tablet application configuration, what can be done what cannot be done etc. For installation it is available in Google store for Android tabs, Windows store for Windows tabs and Apple store for IPAD tabs.

· Want to know how to configure multi entity search for CRM 2013 App. Here you go: Click here

· Want to know how to reconfigure IPAD app and options: Reconfigure vs Sign out for CRM 2013 App. Here you go: Click here

· Want to know Security Privileges required to access CRM 2013…

View original post 50 more words

New in CRM Online Spring ‘14 / Service Pack 1 / Leo: SLAs


The Spring 2013 / SP1 / Leo release for Microsoft Dynamics CRM 2013 provides new functionality for Service Level Agreements (SLAs). The SLAs are configurable to your requirements and provide not only deadline monitoring but also automated warnings and escalations.

In this post I walk through the setup process and show the functionality in action. Invest 5 minutes here and walk away up to speed on this new feature.

Configuration of SLAs

Here’s the logical flow for configuring SLAs:

1Define your Organization’s holiday schedule (the exception days when CRM should stop the clock on its SLA calculations)
2Define your Organization’s customer service hours (e.g. it might be 9 to 5, Mon to Fri or it might be 24 x 7 x 365)
3Create an SLA ‘agreement’ for each Customer Service Offering your Organization provides
4Define the SLA detailfor each agreement. You can create general…

View original post 860 more words

CRM 2013 Service Pack 1: Entitlements, SLAs and That Loveeeely Timer Control


CRM 2013 Service Pack 1 has introduced Enterprise Case Management functionalities, which includes new service entities such as “Entitlement” and “SLA”, and that lovely time control on case forms.

How do I put everything together?

View original post 661 more words

CRM 2011 Context Depth Issue

Danny Varghese's Blog

With CRM 2011 events now being transactional, i.e. when an error occurs, the requested change is rolled back, this has posed its own unique set of problems.  Here’s one I faced recently…

Background Information:

Let’s say a user enters information on a form on any entity and clicks save.  Like any other .NET web application, the data entered by the user is then submitted to the database.  Validation occurs, and if valid, the data is submitted and then finally committed to the database.  The resulting values (including any calculations done by CRM plug-ins) are returned back to the form for the user to see.

In CRM 4.0, all the values entered on a form are submitted to the database as a collection of properties (field names and values).  If any validation errors occurs, the collection of properties containing the values the user entered is NOT submitted, but rather the collection…

View original post 382 more words

Fixed – Unhandled Exception: Microsoft.Crm.CrmException: Cannot create a lookup without the required parameters in CRM 2013


Got this error in one of the steps in the Action. It was updating one of the lookup field using Update step.

The issue was that the lookup field was not in the form. Adding that particular field in the form back resolved the issue.

Hope this helps..



JavaScript Reference for Microsoft Dynamics CRM 2011 / 2013


Here’s a quick reference guide covering Microsoft CRM syntax for common jscript requirements.

Most of the examples are provided as functions that you can easily test in the OnLoad event of the Account form to see a working example.  These are not production hardened but they’ll help you with the CRM syntax.

(updated: 30 July 2012)


  1.   Get the GUID value of a Lookup field
  2.   Get the Text value of a Lookup field
  3.   Get the value of a Text field
  4.   Get the database value of an Option Set field
  5.   Get the text value of an Option Set field
  6.   Get the database value of a Bit field
  7.   Get the value of a Date field
  8.   Get the day, month and year parts from a Date field
  9.   Set the value of a String field
  10. Set the value of an Option Set (pick list)…

View original post 1,401 more words

Using CreateMultiEntityAssociation method of CRMServiceClient for 1: n records.


CreateMultiEntityAssociation method of CrmServiceclient can be used for associating 1 : n records i.e. if we have one contact record that we want to associate with multiple opportunity record ( 1-n) then we can use that method. This way we wont have to update each individual record.

Sample Code

Uri organizationUri = new Uri("http://server/crmrog/XRMServices/2011/Organization.svc");
Uri homeRealmUri = null;
ClientCredentials credentials = new ClientCredentials();
credentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultCredentials;
OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);

CrmServiceClient crmServiceClient = new CrmServiceClient(orgProxy);
List<Guid> lstOpportunityGuid = new List<Guid>();
lstOpportunityGuid.Add(new Guid("9DDCE989-0738-E411-9878-00155D56FF56"));
lstOpportunityGuid.Add(new Guid("019E1598-0738-E411-9878-00155D56FF56"));
lstOpportunityGuid.Add(new Guid("EA393A91-0738-E411-9878-00155D56FF56"));
crmServiceClient.CreateMultiEntityAssociation("contact", new Guid("CF1FC3C0-0738-E411-9878-00155D56FF56"), "opportunity", lstOpportunityGuid, "opportunity_customer_contacts");

Hope it helps ..

Calling a Windows Authenticated WCF Service in a Plugin in CRM


Suppose we need to call the service created here in our plugin

As plugin don’t have configuration file, we need to specify binding information in Code.

The sample code to call the WCF Service by passing Network Credentials

private static void CallWCFService()
BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;

// Specify the endpointAddress
EndpointAddress endpointAddress = new EndpointAddress(new Uri("http://servername:port/Service1.svc"));

ServiceReference1.Service1Client client = new ServiceReference1.Service1Client(binding, endpointAddress);
if (client.ChannelFactory.Credentials != null)
client.ChannelFactory.Credentials.Windows.ClientCredential = new System.Net.NetworkCredential("username", "password", "domain");
if (client.ClientCredentials != null)
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;

Hope it helps ..



Invalid CRMReference Target: The entity Customer doesn’t exist.


Was writing a custom workflow activity on incident entity and in which we wanted the Customer Lookup Value. And based on type of Customer i.e. either contact or account there was some logic to be executed.

So declared an input parameter or type Customer

However while registering the workflow I got the below error

The way to handle this is,

Get the guid of the record from the context and then retrieve the value of customer id attribute.

On retrieval check if the EntityReference is of type account or contact and then proceed accordingly


Hope it helps ..

Microsoft Fakes and LINQ (Custom Workflow Activity) in CRM


Just sharing a sample code to test a custom workflow activity using Microsoft Fakes.

The custom workflow activity uses LINQ.

The custom workflow activity code

public sealed class MyCustomWorkflowActivity : CodeActivity
#region Public Properties

[Input("Stage Name")]
public InArgument<string> StageName { get; set; }


#region Methods

/// <summary>
/// Executes the workflow activity.
/// </summary>
/// <param name="executionContext">
/// The execution context.
/// </param>
protected override void Execute(CodeActivityContext executionContext)
// Create the tracing service
var tracingService = executionContext.GetExtension<ITracingService>();

// Create the context
var context = executionContext.GetExtension<IWorkflowContext>();

var serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();

IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);

using (var xrmServiceContext = new XrmServiceContext(service))
// get the business process workflow id
var workflow = (from w in xrmServiceContext.WorkflowSet
where w.Name == "Business Process Workflow Name"
select new Workflow { WorkflowId = w.WorkflowId }).FirstOrDefault();

if (workflow != null)
// get the stage name from the context's input parameter
var stageName = this.StageName.Get<string>(executionContext);
var stage = (from s in xrmServiceContext.ProcessStageSet
where s.StageName == stageName && s.ProcessId.Id == workflow.WorkflowId
select new ProcessStage { ProcessStageId = s.ProcessStageId }).FirstOrDefault();

if (stage != null)
// update the sales state in the case record to which the above business process flow is associated
var incident = new Incident
Id = context.PrimaryEntityId,
StageId = stage.ProcessStageId
catch (FaultException<OrganizationServiceFault> e)
tracingService.Trace("Exception: {0}", e.ToString());


Unit Test Code

public void UnitTestCustomWorkflowActivity()

var workflowUserId = Guid.NewGuid();
var workflowCorrelationId = Guid.NewGuid();
var workflowInitiatingUserId = Guid.NewGuid();

var service = new Microsoft.Xrm.Sdk.Fakes.StubIOrganizationService();

var workflowContext = new Microsoft.Xrm.Sdk.Workflow.Fakes.StubIWorkflowContext();
workflowContext.UserIdGet = () =>
return workflowUserId;
workflowContext.CorrelationIdGet = () =>
return workflowCorrelationId;
workflowContext.InitiatingUserIdGet = () =>
return workflowInitiatingUserId;

// ITracingService
var tracingService = new Microsoft.Xrm.Sdk.Fakes.StubITracingService();
tracingService.TraceStringObjectArray = (f, o) =>
Debug.WriteLine(f, o);

// IOrganizationServiceFactory
var factory = new Microsoft.Xrm.Sdk.Fakes.StubIOrganizationServiceFactory();
factory.CreateOrganizationServiceNullableOfGuid = id =>
return service;

SetBpfStage target = new SetBpfStage();

var wfEntity = new Workflow();
wfEntity.Id = Guid.NewGuid();
wfEntity["name"] = "abcabcabc";
var wfEntity1 = new Workflow();
wfEntity1.Id = Guid.NewGuid();
wfEntity1["name"] = "abcabcabc";

var processStageEntity = new ProcessStage();
processStageEntity.Id = Guid.NewGuid();
processStageEntity["name"] = "abcabcabc";
service.ExecuteOrganizationRequest = r =>
RetrieveMultipleResponse response = null;
if (((Microsoft.Xrm.Sdk.Query.QueryExpression)((RetrieveMultipleRequest)r).Query).EntityName
== "workflow")
List<Entity> entities = new List<Entity> { wfEntity };

response = new RetrieveMultipleResponse
Results =
new ParameterCollection
new EntityCollection

return response;

if (((Microsoft.Xrm.Sdk.Query.QueryExpression)((RetrieveMultipleRequest)r).Query).EntityName
== "processstage")

List<Entity> entities = new List<Entity> { processStageEntity };

response = new RetrieveMultipleResponse
Results =
new ParameterCollection
new EntityCollection

return response;

return response;

service.UpdateEntity = (p) =>

var invoker = new WorkflowInvoker(target);
invoker.Extensions.Add<ITracingService>(() => tracingService);
invoker.Extensions.Add<IWorkflowContext>(() => workflowContext);
invoker.Extensions.Add<IOrganizationServiceFactory>(() => factory);

var inputs = new Dictionary<string, object>
{ "StageName", "New" }


Hope it helps..

Using LINQ in CRM 2013

There are few ways we can make use of LINQ to write queries against CRM.

Using the early bound entity classes along with the generated service context

Use the CrmSvcUtil tool to generated the early bound entity classes and service context

CrmSvcUtil.exe /url:http://<serverName>/<organizationName>/XRMServices/2011/Organization.svc

/out:<outputFilename>.cs /username:<username> /password:<password> /domain:<domainName>

/namespace:<outputNamespace> /serviceContextName:<serviceContextName>


Uri organizationUri = new Uri("http://server/orgname/XRMServices/2011/Organization.svc");
 Uri homeRealmUri = null;</pre>
<pre> ClientCredentials credentials = new ClientCredentials();
 credentials.Windows.ClientCredential = new System.Net.NetworkCredential("username", "password", "domain");
 OrganizationServiceProxy orgProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, credentials, null);
 IOrganizationService _service = (IOrganizationService)orgProxy; 
 var xrmServiceContext = new XrmServiceContext(_service);
 // get all contact record that has first name as Hugh
 var lstContact = (from c in xrmServiceContext.ContactSet
 where c.FirstName == "Hugh"
 select c).ToList();
 foreach(var contact in lstContact)

Using Early bound entity classes and OrganizationServiceContext

Suppose we have the early bound entity classes but haven’t generated the service context. In this case we can use OrganizationServiceContext


var xrmServiceContext = new OrganizationServiceContext(_service);

var lstContact = (from c in xrmServiceContext.CreateQuery<Contact>()
 where c.FirstName == "Hugh"
 select c).ToList();

foreach (var contact in lstContact)

Using Late bound and OrganizationServiceContext

Suppose we are not generating the early bound classes and using late binding



  var xrmServiceContext = new OrganizationServiceContext(_service);

 var lstContact = (from c in xrmServiceContext.CreateQuery("contact")
 where c["firstname"] == "Hugh"
 select c).ToList();

 foreach (var contact in lstContact)

Hope it helps..


“the specified type is not a known entity type” error while using early bound entity classes in CRM 2013


We were writing a custom workflow activity that was using LINQ (early bound).

Here we had used ILMerge to merge the early bound assemblies with the workflow assembly.

The solution was to place the following attribute in the AssemblyInfo.cs of the workflow assembly (same goes for Plugin Assembly)

[assembly: Microsoft.Xrm.Sdk.Client.ProxyTypesAssemblyAttribute()]


The helpful thread

Hope it helps..



OptionSetId cannot be changed. EnumAttributeInfo.AttributeDescription.OptionSetId(089e077e-6055-446a-ad6e-326f0bee7c9c) != c0864f8b-2c13-e411-93ed-000d3a800961

We got this error while importing the solution. This issue is caused by having an optionset with same name but different guid.

The solution is to identify the field and delete it from the org where we are importing.

select name from optionsetview where optionsetid = ‘c0864f8b-2c13-e411-93ed-000d3a800961’ (the 2nd guid)

The helpful post


CRM 2013 New and Beautiful getClientUrl() method instead of getServerUrl()

Sanghamitra Samantaray

In CRM 2013 Microsoft has introduced this new client context method called “getClientUrl”

This is the replacement to the previous method called “getServerUrl” that was present in CRM 2011.

This method was faulty because it always returns the server name in the URL as it is set up in the CRM deployment manager, irrespective of how the host url looks like.

this is issue in scenarios where users might have invoked CRM using the server IP address or fully qualified domain name etc.

because when in the java script we call getServerUrl it does not return the URL with the server name as it was used by the calling the host url, but that of what is stored in the server, which fails , in the situations where the server name is not accessible from the host machine but the IP or fully qualified name.

in order to correct this…

View original post 125 more words