Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

Xrm.Page.data is undefined - can't access any form data from jScript (CRM 2011)

$
0
0

CRM 2011 on premise, UR12.

We have a lot of javaScript in this environment that has been working fine for a few years now. At some unspecified time, our javaScript on Opportunity completely broke in a way I've never seen before. (And this isn't my first time at the rodeo.) In other words, I don't know what changed to cause this.

For example, I have a utility function:

...
	setFieldRequired : function (field, onOff)
	{
	   if (onOff) {
		   Xrm.Page.data.entity.attributes.get(field).setRequiredLevel("required"); 
	   }
	   else
	   {
		   Xrm.Page.data.entity.attributes.get(field).setRequiredLevel("none"); 
	   }
	   return null;
	},
...

Pretty straightforward, right? Well this is now erroring saying:

SCRIPT5007: Unable to get property 'setRequiredLevel' of undefined or null reference

And I'm getting this any time  I try to access or update any information in any field on the form. It's not a typo in the field name, or a syntax problem. (I even copied/pasted the field name from the UI into the script to be 100% sure.)

The only other symptom is that in F12, when the page loads, I get a million 'action is undefined' pieces.

So I took out all my custom Web Resources from the page. onLoad, I now get:

There are no iFrames or other custom code on this page, except Ribbon actions that call jScript in the web resources I removed. All the fields it references are present on the form. Basically it's a straightforward form with some complicated show/hide rules built out in JavaScript.

... Oh, and it loads fine in Chrome.

So I'm wondering, what can cause the entire Xrm.Page.data to break?

Thanks in advance!


Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>