Tuesday, June 10, 2014

AX 2012: don't party with deleted PurchLines

In previous version of Dynamics AX if you delete a PurchLine record - it's gone from the table; it means that for a given purchase order you've got only "active" actual PurchLine records in the database table. AX 2012 has introduced a lot of new and enhanced Procurement and sourcing features including Change management for purchase orders. From a developer's perspective it means that PurchLine records are no longer deleted - instead they are marked with IsDeleted flag and filtered out on regular forms (obviously except for Purchase order versions form). So in customizations it's now vital to mind that and to select or update only PurchLine records with IsDeleted == NoYes::No predicate in the where clause. PurchTable.queryPurchLine() can provide you with a query that takes this into account.