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

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Use the "DT2Time" function in a table extension field

(0) ShareShare
ReportReport
Posted on by 92

I'm making an extension of the "Bank Account Ledger Entry" table, in which I need to create a new field called "Creation time", which would simply be the time that appears in the "SystemCreatedAt" field of type DateTime, already existing in the table. For this, I want to use the "DT2Time" function to extract the time part of that field and save it in the new field. The problem is, I don't know exactly where I should do this. Would it have to be done in a Trigger or something?

I know that the easiest thing is to do it directly in the page extension, but for this particular case, I need it to be a table field

I have the same question (0)
  • Verified answer
    srttel Profile Picture
    on at
    RE: Use the "DT2Time" function in a table extension field

    In a table extension you have various triggers where you can update the field you want the date you need.

    OnBeforeInsert

    OnInsert

    OnAfterInstert

    OnBeforeModify

    OnModify

    OnAfterModify

    OnBeforeDelete

    OnDelete

    OnAfterDelete

    OnBeforeRename

    OnRename

    OnAfterRename

    docs.microsoft.com/.../devenv-triggers

    If you want to get your field when the record is modified it can look like:

    trigger OnModify()

       begin

           MyTime2 := DT2Time(SystemCreatedAt);

       end;

  • BchM Profile Picture
    92 on at
    RE: Use the "DT2Time" function in a table extension field

    I understand, thanks for responding. I have been testing each of those triggers, but the problem is that the field does not appear, unless there is a change, and I need the field to appear automatically, for each of the existing records. Is there any other way?

  • Suggested answer
    YUN ZHU Profile Picture
    94,369 Super User 2025 Season 2 on at
    RE: Use the "DT2Time" function in a table extension field

    Hi, I think you can make a patch to update the existing records, such as creating a new action, writing a repeat.

    Hope this will help.

    Thanks.

    ZHU

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Pallavi Phade – Community Spotlight

We are honored to recognize Pallavi Phade as our Community Spotlight honoree for…

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,921

#2
YUN ZHU Profile Picture

YUN ZHU 2,012 Super User 2025 Season 2

#3
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,999 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans