locked
CRM 2011 - Hide the Date in a DateTime field (I only want to show the date) RRS feed

  • Question

  • Can anybody help me Hide the date part of a Date/Time field.  I only want to see the Time field displayed.

     

    i have the code for CRM 4.0 need help with CRM 2011

     

    Thanks

     

    Tony

    document.getElementById("new_bankholidaystart").childNodes[0].childNodes[0].style.display = "none";
    document.getElementById("new_bankholidaystart").childNodes[0].childNodes[1].style.display = "none";

    var date = new Date(); date.setHours(8, 30, 0, 0); crmForm.all.new_bankholidaystart.DataValue = date;

     

    Tuesday, May 31, 2011 4:22 PM

Answers

  • Hi,

    Try the following script:

    document.getElementById("new_bankholidaystart").childNodes[1].childNodes[0].childNodes[0].style.display = "none";
    document.getElementById("new_bankholidaystart").childNodes[1].childNodes[0].childNodes[1].style.display = "none";

    var today = new Date();
    var attributes = Xrm.Page.data.entity.attributes.get("new_bankholidaystart");
    var futureDate = new Date(today.setDate(today.getDate() + 5));
    attributes.setValue(futureDate);

    I belivethis answers your question.

     


    Thank You,
    Jehanzeb Javeed,
    http://worldofdynamics.blogspot.com
    Linked-In Profile |CodePlex Profile

    If you find this post helpful then please "Vote as Helpful" and "Mark As Answer".



    • Proposed as answer by Jehanzeb.Javeed Tuesday, May 31, 2011 4:59 PM
    • Unproposed as answer by Jehanzeb.Javeed Thursday, June 2, 2011 5:49 PM
    • Proposed as answer by Jehanzeb.Javeed Thursday, June 2, 2011 5:49 PM
    • Unproposed as answer by Jehanzeb.Javeed Thursday, June 23, 2011 5:05 PM
    • Proposed as answer by Jehanzeb.Javeed Thursday, June 23, 2011 5:05 PM
    • Marked as answer by TD-CRM Friday, June 24, 2011 1:02 PM
    Tuesday, May 31, 2011 4:58 PM