Search code examples
axaptax++dynamics-ax-2012

How do I open a filtered list page from the infolog with one of the SysInfoAction classes


How do I open a filtered list page from the infolog with one of the SysInfoAction classes?

I try this:

static void infoSO(Args _args)
{  
    Query         q = new Query();

    #define.SalesPool('Test')

    q.addDataSource(tableNum(SalesTable)).addRange(
        fieldNum(SalesTable, SalesPoolId)).value(SysQuery::value(#salesPool));

    info('bla', '', SysInfoAction_FormrunQuery::newFormnameQuery(formStr(SalesTableListPage), q));
}

And I get the following error:

The required QueryBuildDataSource was not found in the Query associated with the FormDataSource '%1'. The QueryBuildDataSource should have the same name and table ID as the FormDataSource.


Solution

  • To get rid of the error you can change your code as follows:

    static void infoSO(Args _args)
    {
       Query         q = new Query(queryStr(SalesTableListPage));
    
        #define.SalesPool('Test')
    
        q.dataSourceTable(tableNum(SalesTable)).addRange(
            fieldNum(SalesTable, SalesPoolId)).value(SysQuery::value(#salesPool));
    
        info('bla', '', SysInfoAction_FormrunQuery::newFormnameQuery(formStr(SalesTableListPage), q));
    }
    

    P.S. Instead of opening a list page I would suggest to open the sales order details form.