Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Change date time value on control in form

Posted on by Microsoft Employee

I have a couple of controls in a form with DateTime type. On the init of the form, I am trying to change one of the values to a specific value,  however, it is not updating. String controls work fine.

datetime = datetime2str(element.formatDateTimeToday());
Registration_StartRegistrationDateTime.setUTCString(datetime);


I have also tried using this, but it did not work either,

Registration_StartRegistrationDateTime.dateTimeValue(*UTCDATETIME*);


Any ideas what I am doing wrong?

Additionally, I have another issue, when i select a control to edit (upon click), all the other controls are also updated with the same value.

Thanks,

Matthew

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Change date time value on control in form

    Thanks a lot for your answer. Helped a lot!

  • Verified answer
    Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Change date time value on control in form

    Hi Matthew Calleja,

    If controls are bound to data source fields you need to change field value instead of control value.

    If controls are not bound code like:

    Registration_StartRegistrationDateTime.dateTimeValue(DateTimeUtil::utcNow());

    should work without any issues.

    Regarding your second question you can have such behaviour if multiple controls are bound to same data source filed, in this case value change in one control will change it in all.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,056 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans