Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Auto populate Current date and time field in form

Posted on by 46

Auto populate Current date field in form ax2012

I want when open form then CreateDateTime field auto fill, how??

Any one help me please.

Thank You!

pastedimage1655881388884v1.png

  • Martin Dráb Profile Picture
    Martin Dráb 225,513 Super User on at
    RE: Auto populate Current date and time field in form

    You verify an answer by Did this answer your question? > Yes on the reply (or replies) answering the question.

    You can read more about it in Suggested and Verified Answers.

  • Ahmad0751 Profile Picture
    Ahmad0751 46 on at
    RE: Auto populate Current date and time field in form

    Sir issue resolved.

    Thanks.

  • Martin Dráb Profile Picture
    Martin Dráb 225,513 Super User on at
    RE: Auto populate Current date and time field in form

    If it answered your question, please don't forget to verify the answer.

  • Ahmad0751 Profile Picture
    Ahmad0751 46 on at
    RE: Auto populate Current date and time field in form

    Thank for help.

  • Martin Dráb Profile Picture
    Martin Dráb 225,513 Super User on at
    RE: Auto populate Current date and time field in form

    You can't show the time when the record was inserted to database before it was actually inserted. That's clearly impossible - you don't know when exactly it'll be inserted - or if it'll be inserted at all.

    If you really want, you can create another field with a different meaning - not when the record was created, but when it was initialized and a user could start working on it. Then you could easily initialize the value in initValue() method of the table. But I doubt that this additional field would be useful enough; that's why I recommended stricking to CreatedDateTime.

  • Ahmad0751 Profile Picture
    Ahmad0751 46 on at
    RE: Auto populate Current date and time field in form

    okay you mean when user add record and then show in form otherwise it is not possible?

    Thank you!

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 225,513 Super User on at
    RE: Auto populate Current date and time field in form

    You're looking at the problem from a wrong angle. You want to to initialize the value when creating a new record in the table, not when opening a form. Yes, when you open a form and there is no record, a new one is created, therefore it looks like the same thing in the particular case, but focusing on the form is misleading.

    The problem in your case is that this field is populated when the record is inserted, which didn't happen yet. It'll be populated when you fill mandatory fields and save the record. That's how it works across the system, therefore the best thing you can do is explaining that to users and not making any changes.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,773 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,513 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans