General X++ Development

How do I extend a form datasource method using Chain of Command?

Asked by Sunny Vasty· Aug 13, 2026· 1 answers

How do I extend a form datasource method using Chain of Command?

SSunny Vasty75 reputation · answered Aug 13, 2026

Create an extension for the specific form datasource and wrap the datasource method.

X++
[ExtensionOf(formDataSourceStr(SalesTable, SalesTable))]
final class SalesTable_SalesTable_Extension
{
    public void executeQuery()
    {
        // Add or update ranges here if they must exist before the query runs.

        next executeQuery();
    }
}

Where your custom logic goes depends on whether it must run before or after standard behavior. The wrapper method still needs to call next.