Hi All,
After migrating to Dynamics Sales 9.1 on-premises I get this script error.
Value should be of type: Date: Parameter Name: value
new_over is an option list with the options 1 week and 2 weeks. I want to calculate the datefield pdatum + 7 and + 14 days after an option is selected. Help is much appreciated. Thank you. Jan
function datumover(ExecutionContext){
var datum = ExecutionContext.getFormContext().data.entity.attributes.get("new_pdatum");
var now = new Date();
if(ExecutionContext.getFormContext().getAttribute("new_over").getText() == "1 week")
{
var endDate = new Date().setDate(now.getDate()+7);
datum.setValue(endDate);
}
if(ExecutionContext.getFormContext().getAttribute("new_over").getText() == "2 weken")
{
var endDate = new Date().setDate(now.getDate()+14);
datum.setValue(endDate);
}
}