2014年12月30日 星期二

CRM 2011 Set DateTime Value in JavaScript


CRM 2011 Set DateTime Value in JavaScript




JavaScript:
function OnLoadForm()
{
    confirmApproval();
    // OR
    confirmApproval2();
}
function confirmApproval()
{
   var currentDateTime = new Date();
   Xrm.Page.getAttribute("new_approvaldate").setValue(currentDateTime);
}
function confirmApproval2()
{
   var currentDateTime = new Date();
   control = Xrm.Page.getControl("new_approvalddate");
   attribute = control.getAttribute();
   attribute.setValue(currentDateTime);
}

沒有留言:

張貼留言