Anyone aware of an override that can be used to run a method whenever a view is launched in AX 2012 x++?
The intent is to use a class method to update some values in a table before the view runs its query.
I don't see an init method or anything along those lines in the available overrides.
Thanks!
There is no solution to this in the exact way that you are asking.
There is no override that will be launched because the view "code" is not x++, it is SQL code. The view is a precompiled SQL query that acts as a table and is stored in the SQL database. Now you might notice Views are implemented in x++ as inheriting from the Common object. Thus they have similar behavior as tables. Tables do not have methods that run before being "launched" as you say, but are queried using select update delete etc. Unfortunately views do not have the same event list in the MorphX designer as tables do.
Perhaps to solve your requirement, instead of looking for an override on the View itself, look for an override in the specific location that the view is being used. A simple example could be this: if the View is used as a datasource on a form, you would override the executeQuery()
method on the form's datasource (which would be your view), and modify certain things before the query on the view is executed. This is obviously difficult to manage as a View could be used anywhere, so you would have to pay close attention to where the view is being used.