web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

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

(0) ShareShare
ReportReport
Posted on by 135

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);
}
}

I have the same question (0)
  • Verified answer
    Bipin D365 Profile Picture
    28,985 Moderator on at

    Hi,

    Try below code to calculate endDate

    Var endDate=new Date(new Date().setDate(now.getDate()+7));

    Thanks,

    Bipin

  • Jan N Profile Picture
    135 on at

    Hi Bipin.

    It functions! Thank you very much for your solution!

    Jan

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 69 Most Valuable Professional

#2
ManoVerse Profile Picture

ManoVerse 55 Super User 2026 Season 1

#3
11manish Profile Picture

11manish 37

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans