Script error Value should be of type: Date: Parameter Name: value

Jan 1 Reputation point
2022-05-03T10:18:43.967+00:00

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_prikdatum is an option list with the options 1 week and 2 weeks. I want to calculate the datefield prikdatum after an option is selected. help is much appreciated. Thank you.

//********Prikdatum berekenen********
function prikdatumover(ExecutionContext){
var prikdatum = ExecutionContext.getFormContext().data.entity.attributes.get("new_prikdatum");
var now = new Date();

  if(ExecutionContext.getFormContext().getAttribute("new_over").getText() == "1 week")

{
var endDate = new Date().setDate(now.getDate()+7);
prikdatum.setValue(endDate);
}

if(ExecutionContext.getFormContext().getAttribute("new_over").getText() == "2 weken")

{
var endDate = new Date().setDate(now.getDate()+14);
prikdatum.setValue(endDate);
}
}

Microsoft 365 Publishing
Microsoft 365 Publishing
Microsoft 365: Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line. Publishing: The process of preparing, producing, and releasing content for distribution or sale.
598 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Andrew Murdoch 0 Reputation points
    2023-09-05T09:51:19.7766667+00:00

    Hi Jan, did you ever get this working? I'm having the same issue....

    0 comments No comments