I am working in CRM 2013 where i need to set a date of my textbox and save it to CRM 2013 database.
look at my code :
var CRMForm = document.parentWindow.parent.Xrm.Page;
var currentDateTime = new Date();
CRMForm.getAttribute("date").setValue(currentDateTime);
But i am getting an exception here : Out of stack space
Got the solution myself and its as following :
var dt= CRMForm.getAttribute("date");
if(dt.getValue() != null)
{
dt.setValue(dt.getValue().setFullYear(currentDateTime.getFullYear()));
dt.setValue(dt.getValue().setDate(currentDateTime.getDate()));
dt.setValue(dt.getValue().setMonth(currentDateTime.getMonth()));
}