web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :

Open User selectable query from Code in D365FO Using X++ and Query Classes

Bharani Preetham Peraka Profile Picture Bharani Preetham Pe... 3,634 Moderator
If let's say there is a requirement to show a filter query where user can add different ranges he wants and once he clicks 'Ok', based on the query selected by user, the form should render. Or let's say we need to show the filter query button which will be same as the 'Records to include' in SSRS reports. on a form so when user clicks the button then it will show a form where should be able to add ranges.
 
So, how is this possible by X++ and Query classes?
 
Let's not wait and will check the plan.
 
    public void init()
    {
        super();

        Query query = new Query();
        SysQueryRun queryRun;

        query = CustInvoiceTrans_ds.query();
        queryRun = new SysQueryRun(new Query(query));

        queryRun.args().caller(this);
        queryRun.title("Invoice Journal Report");

        queryRun.args().allowUseOfPreloadedForm(false);
        queryRun.promptAllowAddRange(QueryAllowAdd::NoFields);

        if (queryRun.prompt())
        {
            CustInvoiceTrans_ds.query(queryRun.query());
        }

        else
        {
            element.close();
        }


        
    }
 

Comments

*This post is locked for comments