Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Add Days to Date 01

Posted on by 40

Hello there!,

I am using following script to add days in date 

function OnLoad()

{
Xrm.Page.getAttribute("hs_dispatchdate").addOnChange(DateOrDaysOnChange);
Xrm.Page.getAttribute("hs_datevalue").addOnChange(DateOrDaysOnChange);
}

function DateOrDaysOnChange()
{
var dateform = Xrm.Page.getAttribute("hs_arrivaldate").getValue();
var adddays = Xrm.Page.getAttribute("hs_datevalue").getValue();
Var newDate = newDate(dateform);

newdate.setDate(newdate.getDate() + adddays);

Xrm.Page.getAtrribute("hs_arrivaldate").setValue(newdate);
}

but facing some turboform error

ReferenceError: DateOrDaysOnChange is not defined
at eval (eval at RunHandlerInternal (methodexsystemsltd.crm5.dynamics.com/.../ClientApiWrapper.aspx), <anonymous>:1:1)
at RunHandlerInternal (methodexsystemsltd.crm5.dynamics.com/.../ClientApiWrapper.aspx)
at RunHandlers (methodexsystemsltd.crm5.dynamics.com/.../ClientApiWrapper.aspx)
at ExecuteHandler (methodexsystemsltd.crm5.dynamics.com/.../ClientApiWrapper.aspx)
at Mscrm.TurboForm.Control.CustomScriptsManager.$Df_1 (methodexsystemsltd.crm5.dynamics.com/.../formcontrols.js)
at Mscrm.TurboForm.Control.CustomScriptsManager.executeHandler (methodexsystemsltd.crm5.dynamics.com/.../formcontrols.js)
at Mscrm.TurboForm.Control.CustomScriptsManager.executeHandlerByDescriptor (methodexsystemsltd.crm5.dynamics.com/.../formcontrols.js)
at methodexsystemsltd.crm5.dynamics.com/.../formcontrols.js
at methodexsystemsltd.crm5.dynamics.com/.../global.ashx
at Mscrm.TurboForm.Control.Data.DateTimeDataAttribute.fireOnChange (methodexsystemsltd.crm5.dynamics.com/.../formcontrols.js)

Please help!

Thanks in Advance

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Add Days to Date 01

    Hi,

    try to change the below code

    Var newDate = newDate(dateform);  ---------> var newDate = new Date(dateform);

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans