X++ disable fields base on another field with lookup option

Here is the challenge I’m facing:

Main Form X has a field(string type) called Y & Y filed has a lookup with data entered(CAN 2, CAN4, CAN6) created separate table & form for this Y lookup/drop-down)

  1. When user clicks on the drop-down lookup menu on Field Y and choses value 4 or 6, 3 other fields, lets just say Field K, Field L, Field M must be disabled. How do I write X++ code for this and what type of override method? Do I override it on Form method or Data source’s individual field method?

Form>method>override>Active method? or Form>DataSource>Fields>Field Y>override modified method?

Thanks!

Let’s say that Field K is displayed twice in the form - on both Overview and General tabs. Do you want to disable it in both places? If so (which is the usual case), you don’t want to deal with both controls individually - you want to do everything on the datasource level.

I don’t see how you would use active() to implement your requirement. If you want to execute some code when user changes a field value, datasource field’s modified() method sounds like a good place, doesn’t it?