2014年12月30日 星期二

CRM 2011 Set DateTime Value in JavaScript


CRM 2011 Set DateTime Value in JavaScript




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

沒有留言:

張貼留言