Skip to content

Instantly share code, notes, and snippets.

@D4R4
Created October 13, 2021 20:05
Show Gist options
  • Save D4R4/a9801eca229a71c1909fdb7c75ab740a to your computer and use it in GitHub Desktop.
Save D4R4/a9801eca229a71c1909fdb7c75ab740a to your computer and use it in GitHub Desktop.
Take date form field value and add days to it. Dynamics 365 Web Resource
function addDays(date, days) {
var result = new Date(date);
result.setDate(result.getDate() + parseInt(days));
return result;
}
function recalculateDateFieldValue() {
var date= Xrm.Page.getAttribute("effectivefrom").getValue();
if (date != null) {
Xrm.Page.getAttribute("effectiveto").setValue(addDays(date, 30));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment