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

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

How to get a table record inside an OnValidate() trigger?

(0) ShareShare
ReportReport
Posted on by 481

Right now in a Sales Header table extension I have an OnValidate() trigger on one of the fields.
I initialized a Var inside this trigger of type "Record". I've applied a SetRange to get a single row, but trying to access a field on the record via Record.fieldname, results in an empty value.
I've tried using Record.get before the setrange but still no luck

How do I properly get a record in an OnValidate trigger?

I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    95,729 Super User 2025 Season 2 on at

    Hi, It looks like you are missing the Find function.

    A simple Example:

    pastedimage1655164046478v2.png

    pastedimage1655164033015v1.png

    Hope this helps.

    Thanks.

    ZHU

  • Suggested answer
    Nitin Verma Profile Picture
    21,708 Moderator on at

    Hi jdrco ,

    Might be you had missed the findfirst after setrange and you are getting empty values, please use Zhu example.

    Thanks.

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,468

#2
YUN ZHU Profile Picture

YUN ZHU 923 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans