Friday, 18 May 2012 3:13 PM
Trying to leverage code we created. This code works in one deployment, but gives the above error (onLoad) in a second deployment. Any ideas?
var CRM_FORM_TYPE_CREATE = 1;
var CRM_FORM_TYPE_UPDATE = 2;
var CRM_FORM_TYPE_READONLY = 3;
var CRM_FORM_TYPE_DISABLED = 4;
var CRM_FORM_TYPE_BULKEDIT = 6;
var CRM_FORM_TYPE_UNDEFINED = 0;
var Statecode = Xrm.Page.getAttribute("statecode").getValue();
if (Statecode =='Resolved'|| Statecode == 'Canceled')
else if((Xrm.Page.ui.getFormType() == CRM_FORM_TYPE_UPDATE || Xrm.Page.ui.getFormType() == CRM_FORM_TYPE_READONLY || Xrm.Page.ui.getFormType() == CRM_FORM_TYPE_DISABLED) )
var oneMinute = 60 * 1000;
var oneHour = oneMinute * 60;
var oneDay = oneHour * 24;
var today = new Date();
if (Xrm.Page.getAttribute("createdon").getValue() != null)
var diff = today.getTime() - Xrm.Page.getAttribute("createdon").getValue().getTime();
diff = Math.floor(diff/oneDay);
- Moved by Andrii ButenkoMVP, Moderator Friday, 18 May 2012 3:27 PM (From:CRM)
Friday, 18 May 2012 3:32 PMModerator
Friday, 18 May 2012 6:18 PM
Can you check if you have all the fields mentiond in this script are added in "Dependent fields"? (Form Properties --> Event handlers --> Edit --> Dependencies tab)
Friday, 18 May 2012 7:56 PM
First thing, check whether the fields you are trying to get value are present in the form not in the unused fields.
If it is fine for you, tell me at which line of your code, you are getting the error.?
Saurabh Gupta, MS CRM 2011 Software Development Engineer
- Marked As Answer by kcompter Friday, 18 May 2012 8:39 PM
Friday, 18 May 2012 8:36 PMIn which line of code you are getting the error ?
Friday, 18 May 2012 8:39 PM
That was the answer! Sometimes it is always the simple things. Thank you all for sending suggestions!