The AL developer preview is still evolving with frequent updates. Follow us on the Dynamics NAV Team Blog for the announcements.

OnBeforeOpen Trigger

Executed before a query is run and the dataset is generated.




The AL code of a query object includes the OnBeforeOpen trigger that you can use to change the data that will be included in the resulting dataset. For example, you can use the OnBeforeOpen trigger to apply filters to a column.

The OnBeforeOpen trigger only supports local variables; global variables are not supported.


A query cannot be run from the OnBeforeOpen trigger. You cannot call methods from the triggers that run the query, such as OPEN, SAVEASXML, READ, or CLOSE methods.


The following code applies a filter on the Quantity column of the query by calling the SETFILTER on the OnBeforeOpen trigger of the query object.

currQuery.SETFILTER(Quantity, '>50');  

See Also