D365F&O - X++ - Filter the form records based on the caller form in excuteQuery method

 1- Open the form designer.

2- Go to datasource, expand and right click on methods.

3-  select override executeQuery method.

public void executeQuery()
{
    // Get the calling  form record
    OrderRefundTable orderRefund = element.args().record();
    QueryBuildDataSource  queryBuildDataSource;            
    queryBuildDataSource = this.query().dataSourceTable(tablenum(OrderRefundTable));
    queryBuildDataSource.clearRanges();

    // Add range to your current form datasource
    queryBuildDataSource.addRange(fieldnum(OrderRefundTable, SalesId)).value
        (queryValue(orderRefund.SalesId));
    super();
   
}


Comments

Popular posts from this blog

D365F&O - X++ - Best Practice Warning BP Rule: [BPErrorUnknownLabel]: Path:

D365F&O - X++ - How to Enable/Disable button on form based on a condition in D365F&O using Event handlers.

D365FO - X++ - Generate CAR (Customized Analysis Report) report of custom model