 <p>Try following code:</p> <pre><code>function SetOneplusyearminus1date() { debugger; var start = Xrm.Page.getAttribute("msdyn_startdate").getValue(); if (start != null) { start.setDate(start.getDate() - 1); start.setYear(start.getFullYear() + 1); Xrm.Page.getAttribute("msdyn_enddate").setValue(start); } } </code></pre>