Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics NAV (Archived)

Please Tell me Difference between On Validate Trigger and Validate Function.

Posted on by Microsoft Employee

Hi please tell me about this

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Please Tell me Difference between On Validate Trigger and Validate Function.

    Verified

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Please Tell me Difference between On Validate Trigger and Validate Function.

    Thank sir

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Please Tell me Difference between On Validate Trigger and Validate Function.

    Thanks Sir

  • Suggested answer
    Amol Salvi Profile Picture
    Amol Salvi 18,694 on at
    RE: Please Tell me Difference between On Validate Trigger and Validate Function.

    Hi Mohti,

    You can look at this two links

    msdn.microsoft.com/.../dd338867(v=nav.90).aspx

    msdn.microsoft.com/.../dd338618(v=nav.90).aspx

  • Suggested answer
    Alexander Ermakov Profile Picture
    Alexander Ermakov 28,094 on at
    RE: Please Tell me Difference between On Validate Trigger and Validate Function.

    "The VALIDATE function is useful for centralizing processing and thereby making your application easier to maintain.

    For example, if the OnValidate trigger of the Total Amount field performs a calculation that uses values from three other fields as operands, the calculation must be performed again if the contents of any of these fields changes.

    You should avoid entering the calculation formula in the OnValidate triggers of each field because this can create errors if the calculation formula has to be changed later and you have to update the code in all the triggers. Instead, you should enter the calculation formula in the OnValidate trigger of only one of the fields and call this trigger code from the OnValidate triggers of the other fields."

  • Suggested answer
    Binesh Profile Picture
    Binesh 7,885 on at
    RE: Please Tell me Difference between On Validate Trigger and Validate Function.

    VALIDATE Function (Record)

    -> Calls the OnValidate trigger for the field that you specify.

    -> VALIDATE first checks any TableRelation Property and then executes the OnValidate (Fields) Trigger of the field.

    -> If you omit NewValue, then the function validates the current value.

    -> Use this function to enter a new value into a field and have the new value validated by the properties and code that have been defined for that field.

    ->    VALIDATE function we use to initialize value, but internally it first call the OnValidate trigger.

    OnValidate Trigger

    -> Executed when a field loses focus after its value has been changed.

    -> Use this trigger to validate user entries in a page field. If validation fails, then the field is marked with an error and its value is not saved.

    -> This trigger is executed after the default validation behavior. An error message displays if an error occurs in the trigger code. In case of an error, the user entry is not written to the database.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Please Tell me Difference between On Validate Trigger and Validate Function.

    validate trigger is a default event that run automatically when you change data in the table, the code is stored directly in the table

    msdn.microsoft.com/.../dd338867(v=nav.90).aspx

    validate function calls the OnValidate trigger for the field that you specify when you want for example in a dataport or in a codeunit

    msdn.microsoft.com/.../dd338618(v=nav.90).aspx

  • Verified answer
    Mohana Yadav Profile Picture
    Mohana Yadav 59,139 Super User 2024 Season 2 on at
    RE: Please Tell me Difference between On Validate Trigger and Validate Function.

    code written in validate trigger of a field will be executed if you manually enter and press tab or calling validate function of field with code.

    it wont be executed if you simply assign value to this field in code.

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

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