Your data entity might not operate, as expected, if you haven't taken care of it your Entity data-structure already

 


D365FO DMF has an inherent issue with the grouping of its data sources. If you have selected/included a field under the group Node:







And you have already set the change-tracking enabled in your datasource:






Then when you turn on the Change tracking of the entity as 'Enable primary datasource'  and if you have enabled the incremental data: then this structure simply won't work. 


When you run it, the export simply fails to export any record, although when you run it in 'Full push' mode, it works as expected.

Reason: the underlying query for primary datasource for change tracking simply fails to extract data, based on group-by field, explicitly. The table query 'AifSqlChangeTrackingEnabledTables' treats only those records which got changed/created based on timestamp and processes them accordingly.

In all such cases make us of your CT query and include the group by field you want to include in your code:

public static Query defaultCTQuery()

    {

        Query q = new Query();

   

        QueryBuildDataSource custInvoiceJourDs = q.addDataSource(tableNum(CustinvoiceJour));

        custInvoiceJourDs.addGroupByField(fieldnum(CustInvoiveJour, SalesId));

        return q;

    }

Once you do this, you turn on the 'Enable custom query' in your entity, and try exporting now, in incremental mode. It will work as expected.


Comments

Popular posts from this blog

X++ : mistakes which developers commit the most

Make your menu items visible on main menu, conditionally,, using this cool feature of D365FO

Speed up your execution performance by using SysGlobalCaches