Best method to Add field validation in BC SaaS

jordi79jordi79 Member Posts: 274
Hi,

There are 2 ways to add a validation trigger to an existing field in BC.

1) Subscriber codeunit that subscribes to the table OnAfterValidate Event

2) A TableExtension that Modifies the field OnAfterValidate trigger

Which is best and what is the pros and cons of each method?

All this while I have been using the Subscriber codeunit method, until recently when I realised that I could also achieve the same using a TableExtension.

Thanks for reading.

Answers

  • TallyHoTallyHo Member Posts: 413
    It is the same afaik. I move my subscribers to the pageeext onaftervalidate as soon a there is one. It provides a better insight in What is modified.
  • SivaguruSivaguru Member Posts: 3
    TallyHo wrote: »
    It is the same afaik. I move my subscribers to the pageeext onaftervalidate as soon a there is one. It provides a better insight in What is modified.

    But, adding the logic to the PageExtension would only fire the code if the field was modified from that particular page which the page extension is extending. if you want the code to fire no matter which page the field was modified from, I suggest using the Table Extension or the Codeunit Method subscribing to the Table's OnAfterValidate Event.
  • TallyHoTallyHo Member Posts: 413
    I'm sorry, I meant tableextension where i wrote paggextension
Sign In or Register to comment.