OnValidate() & OnLookup()
sridhar
Member Posts: 171
What is the difference between OnValidate() & OnLookup() ? Any Example please...
0
Comments
-
Use the help.
OnValidate (Fields)
The C/AL code in this trigger is executed when the system validates user input.
Applies to
Fields
Comments
The system executes this trigger after it executes its default validation behavior.
If there is an error in the C/AL code you enter into this trigger, the system displays an error message, leaves the user's entry in the field, but does not write the record to the database.
OnLookup (Fields)
The C/AL code in this trigger causes the system to display a lookup window you design.
There are three layers of lookups in the system. The first layer is the system's default lookup behavior, which provides a lookup into the table with no filters applied or any other special parameters. You can use this trigger to define a lookup for the field, which the system will use in place of its standard behavior. Finally, for the text box, you can define a lookup the system will use in place of the system's standard behavior or the lookup defined in this trigger - see OnLookup for a description of that trigger.
Applies to
Fields
Comments
The system executes this trigger instead of its default lookup behavior.
When using this trigger you typically first take a value from the field to determine what filters to apply or any other special parameters. Then you run the lookup form in modal mode. Next you transfer the value the user selects back to the field when the user chooses OK.
If there is an error in the C/AL code you enter into this trigger, the system closes the lookup form.
Examples for Onvalidate and onlookup. The lookup trigger is using, when you will for example run a form in Lookupmode.Code - OnValidate() //after person makes an input he will show a message message('%1 / %2 / %3',TABLECAPTION,FIELDCAPTION(Code),'Code - OnValidate()'); Code - OnLookup() //if this trigger has lines, the control on a form which ref. //to this field becomes an Arrow message('%1 / %2 / %3',TABLECAPTION,FIELDCAPTION(Code),'Code - OnLookup()'); if form.runmodal(Form::XYZ,VarRec) = Action::Lookupok then validate(Code,VarRec.code);
RegardsDo you make it right, it works too!1 -
Thanks Garak0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions