CRM 2011 Context Depth Issue


Originally posted on 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 393 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


Originally posted on GT // CRM:

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 2,697 more words

Check if a user is a SharePoint Administrator in JavaScript – SharePoint 2013.



Had a requirement to check if user is a SharePoint Admin or not and accordingly hide few elements in the page. We used the below code in our custom master page

Sample Code

var currentUser;

function IsUserAdmin() {
clientContext = SP.ClientContext.get_current();
spWeb = clientContext.get_web();
currentUser = spWeb.get_currentUser();
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));

function onQuerySucceeded(sender, args) {

var isUserAdmin = currentUser.get_isSiteAdmin();
if (isUserAdmin) {

alert('Current User is Administrator');

} else {

alert('Current User is not an Administrator');

function onQueryFailed(sender, args) {

alert('Request failed. ' + args.get_message() +
'\n' + args.get_stackTrace());

ExecuteOrDelayUntilScriptLoaded(GetCount, "sp.js");

Hope it helps ..