Advertisements

Archive

Posts Tagged ‘$ undefined’

ADX Portals 7.x – ‘Page_Validators’ is undefined

Other day, while adding a custom validator using JScript on an Entity Form, I was getting ‘Page_Validators’ is undefined error, at below line of code.

// Add the custom validator to Web Page’s validators array
Page_Validators.push(spouseValidator);

Reason:

  • The dynamics CRM form, associated to the ADX Entity Form, does’t have any required field, hence ‘Page_Validators’ array is NULL as ADX did’t need to load any validators.

Fix:

  • ‘Page_Validators’ is a validator collection and we dont have control over this.
  • Below workaround worked for us:
    • Make one of the field as ‘Required’ by adding ‘Entity Form Metadata’. ADX instantiates ‘Page_Validators’ array, as there is Required field now.
    • You can make the field as Non-required in the JScript.

Metadata_1

Note:

  • This behavior is fixed in further versions of ADX and Dynamics Portals.

🙂

 

 

Advertisements

Xrm.Utility is undefined error – CRM 2011

Other day when I deployed my solution on a new CRM server, I was getting “Xrm.Utility is undefined” script error.

I refered“Xrm.Utility” JScriptin my code to open forms which was causing script issue.

Reason & Fix

  • The CRM server is not having UR 8
  • Since Xrm.Utility object was added in CRM 2011 Update Rollup 8, installing UR 8 on server solved the issue

🙂

Using JQuery and Json in Ribbon button’s function handler

February 6, 2012 3 comments

Hi,

  • In one of my CRM 2011 requirement, I had to update a record using ribbon button placed on CRM grid.
  • I had written an update script which calls OData service using Json & JQuery. (link)
  • But when I execute the function, I got “$ undefined” exception.
  • I wondered since I already had “Json.js” & “JQuery.js” web resources added to my entity.
  • After digging deeper, I came to know that, “JQuery.js” web resource is not getting loaded when my ribbon button’s function handler fired.

Fix :-

  • I fixed the problem by loading “JQuery.js” web resource dynamically, before I call my update method.
  • Below is the script to load the web resource’s

    var JScriptWebResourceUrl = “../WebResources/new_JQuery”;

var xmlHttp = new ActiveXObject(“Microsoft.XMLHTTP”);

xmlHttp.open(“GET”, JScriptWebResourceUrl, false);

xmlHttp.send();

eval(xmlHttp.responseText);

Hope it helps 🙂