locked
set Date in CRM RRS feed

  • Question

  • i want to set the Date field in crm 2011 By java script

    Xrm.Page.getAttribute("new_date1").setValue(1/1/1998);

    functionality want to set date on date filed as 1/1/1998 on load with javascript .....................


    Muhammad Sohail

    Monday, November 26, 2012 1:17 PM

Answers

All replies

  • Hi,

    Check the following links -

    http://social.microsoft.com/Forums/en/crmdeployment/thread/a87ab815-5c99-4680-878d-90fb6cdbb80f

    http://mahenderpal.wordpress.com/2011/09/14/setting-datetime-field-in-ms-crm-2011/
    • Edited by _Vikram Monday, November 26, 2012 1:21 PM
    Monday, November 26, 2012 1:20 PM
  • i already mention to set Date 1/1/1998 not current Date You provided link to set Current Date but i want to as above question


    Muhammad Sohail

    Monday, November 26, 2012 1:52 PM
  • Try this:

    var d = new Date('1/1/1998');
    Xrm.Page.getAttribute("new_date1").setValue(d);


    Jason Lattimer
    My Blog -  Follow me on Twitter -  LinkedIn

    Monday, November 26, 2012 2:13 PM
    Moderator
  • Try this: 

    var date = new Date('1/1/1998');

    date.setHours(0, 0, 0, 0); //(Mid night)// if you want some other time try date.setHours(12, 0, 0, 0); 

    Xrm.Page.getAttribute("new_date1").setValue(date);


    Chandan

    Tuesday, November 27, 2012 11:47 AM