Form Field OnAfterValidate event is not called ??

aquawateraquawater Member Posts: 71
The subject is exactly what I am wondering.
Here is the story..

There is a customization on Purchase Line table,
Field: No.
Event: OnLookUp
This custom lookup will call Item Vendor catalog (if the type is ITEM) and call Validate after Item No. is selected.

The problem is in Purchase Order form, OnAfterValidate event is not called after user select Item No (it doesn't trigger InsertExtendedText method). We need this because we need to use Auto. Extended Text in Purchase Line.
The corresponding Item has been setup correctly.
Any advice?
Or how do I call InsertExtendedText after user select Item No?

But please do not advice me.. 'you should just use the standard/default lookup' and stuff like that... :whistle:
Thanks in advance.

Comments

  • kinekine Member Posts: 12,562
    1) All depends on the lookup function, which lookup is changed? On the form or on the table? If on the form, ends the function with Exit(True) when something is correctly selected?
    2) You can hit some issues when inserting extended text from OnValidate trigger. E.g. in situation, when you insert the extended texts, but the OnModify of the line will end by error. In this case, you have the extended texts inserted but the change of the No. field is not saved. Or when you call the OnLookup and OnValidate of new, inserted line. How you will insert the extended texts, when you do not know Line No. yet?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • garakgarak Member Posts: 3,263
    thats a know feature. Why do you not use the TableRelation property to run the lookup?
    Do you make it right, it works too!
  • aquawateraquawater Member Posts: 71
    kine wrote:
    1) All depends on the lookup function, which lookup is changed? On the form or on the table? If on the form, ends the function with Exit(True) when something is correctly selected?
    2) You can hit some issues when inserting extended text from OnValidate trigger. E.g. in situation, when you insert the extended texts, but the OnModify of the line will end by error. In this case, you have the extended texts inserted but the change of the No. field is not saved. Or when you call the OnLookup and OnValidate of new, inserted line. How you will insert the extended texts, when you do not know Line No. yet?

    I mentioned the lookup is changed on TABLE.
    "There is a customization on Purchase Line table,
    Field: No.
    Event: OnLookUp"
  • kinekine Member Posts: 12,562
    Ok, than the OnAfterValidate will not be triggered, because the validation is started on table level, not on the form level. It is why it is better to write code on tables, not on forms...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.