Options

Override OnValidate trigger on table field

weneedweneed Member Posts: 81
There I a way to skip onvalidate trigger in table filed?

Answers

  • Options
    JuhlJuhl Member Posts: 724
    From code yes, from page no
    Follow me on my blog juhl.blog
  • Options
    weneedweneed Member Posts: 81
    I mean without modifying the Microsoft code but using an extension. How?
  • Options
    TallyHoTallyHo Member Posts: 383
    Like Juhl said, just don't validate the field in your extension code, assign it.
    If using a page for input, try to do the same by indirectly assigning it.
  • Options
    DenSterDenSter Member Posts: 8,304
    You can set a field value without validating it, which simply doesn't execute the OnValidate code. You can subscribe to OnBefore and OnAfter, and you can add code to OnValidate triggers in table extensions. Some OnValidate triggers raise event publishers that you can subscribe to in your extension.

    What you cannot do is disable the OnValidate code in an extension. If BC (whether it's the base app or your extension) causes a field validation, it will always run the code in the OnValidate trigger.
  • Options
    weneedweneed Member Posts: 81
    edited 2020-05-01
    So solution is to expose another field in a page and assign value to original field through code without validation.
  • Options
    TallyHoTallyHo Member Posts: 383
    edited 2020-05-01
    Correct, or expose a global variable, that should do the job in a card page.
  • Options
    RockWithNAVRockWithNAV Member Posts: 1,139
    That was a solution how to disable On Validate trigger but another important question and decision is - Do you really disable it and if it standard NAV field?
Sign In or Register to comment.