Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 82002

Set a specific date and year in a MS CRM date time field in the onchange event

$
0
0

I have two date time fields. In the first field, if the date is set, then in the second date time field, the date should be automatically populated with this format.

For example:

Start date: 1: 09/30/2016

Then result should be as following:

End date : 09/29/2017. 

Following is my code:

function SetOneplusyearminus1date() {
    debugger;
    var start = Xrm.Page.getAttribute("msdyn_startdate").getValue();
    if (start != null) {
        var endDate = start.setDate(start.getDate() - 1); //To get the result date as -1 of original date
        var endYear = start.setYear(start.getFullYear() + 1);
        var ending = endYear + endDate;
        Xrm.Page.getAttribute("msdyn_enddate").setValue(ending);
    }
}

I am getting a different result.

So please help me with your suggestions.


Viewing all articles
Browse latest Browse all 82002

Latest Images

Trending Articles



Latest Images