locked
CRM 2016 : Set default date as Weekend date RRS feed

  • Question

  • Hi All,

    I'm working on CRM 2016 and I'm working on the requirement to set a default date as Friday for the date attribute.
    Can some one please help how set that.

    I tried below logic but it is not working.

     var WeekDate = Xrm.Page.data.entity.attributes.get("new_friday");
            var today = new Date();
            var WeekendDate = new Date(today.setDate(today.getDate() + 7));
            WeekDate.setValue(WeekendDate);

    Thanks,
    Rahul




    • Edited by Rahul-22 Friday, July 1, 2016 1:32 PM
    Friday, July 1, 2016 1:32 PM

Answers

  • Hi,

    I got the solution,

    var curr = new Date;
    var Weekday= curr.getDate() - curr.getDay();
    var EndDay= Weekday+ 5; 
    var Weekend = new Date(curr.setDate(EndDay));
    Weekend.format("mm/dd/yy");
    var Tweekendg = Xrm.Page.data.entity.attributes.get("new_Friday")
    Tweekendg .SetValue(EndDay);

    Thanks,


    Rahul



    • Marked as answer by Rahul-22 Friday, July 1, 2016 2:18 PM
    • Edited by Rahul-22 Friday, July 1, 2016 2:19 PM
    Friday, July 1, 2016 2:18 PM