G'day experts,
I'm currently struggling with an issue related to the SalesTableListPage query that is used on the SalesTableListPage form.
I'm trying to join a temporary table to the SalesTableListPage query based on records with a certain value linked to a financial dimension. When extending the existing SalesTableListPage query and adding the new temp table on SalesTable.SalesId == TmpTable.SalesId the records are correctly filterd but I need to do this through conditions in X code related roles linked to the current user.
Essentially, I need to do this, but conditionally in code:

The code I've tried so far assuming that it should happen on FormDataSourceEventType::QueryExecuting:
[ExtensionOf(formStr(SalesTableListPage))]
final class ACCSalesTableListPage_Extension
{
[FormDataSourceEventHandler(formDataSourceStr(SalesTableListPage, SalesTable), FormDataSourceEventType::QueryExecuting)]
public static void SalesTable_OnQueryExecuting(FormDataSource sender, FormDataSourceEventArgs e)
{
QueryBuildDataSource queryBuildDataSource;
queryBuildDataSource = sender.query().dataSourceTable(tablenum(SalesTable));
queryBuildDataSource.clearRanges();
queryBuildDataSource.addDataSource(tableNum(ACCRestrictCampusDimensionValueVCGPPTTmp_SalesTable));
queryBuildDataSource.addLink(fieldnum(SalesTable, SalesId),fieldnum(ACCRestrictCampusDimensionValueVCGPPTTmp_SalesTable, SalesId));
}
}
What am I missing here because the query doesn't seem to execute at all not even with an error?
Kind regards,
Hein