Obsolete field/method Corresponding InventIAvailability method InventSum.AvailOrdered InventIAvailability.availTotal() InventSum.availOrderedCalculated() InventIAvailability.availTotal() InventSum.AvailPhysical InventIAvailability.availPhysical() InventSum.availPhysicalCalculated() InventIAvailability.availPhysical() InventSum.availReservation() InventIAvailability.availReservation() InventSum.Ordered InventIAvailability.ordered() InventSum.orderedSum() InventIAvailability.orderedSum() InventSum.ReservOrdered InventIAvailability.reservOrdered() InventSum.ReservPhysical InventIAvailability.reservPhysical()For example:
inventSum.ReservPhysicalShould be replaced with:
InventAvailabilityProvider::findByItemIdDim(_itemId, _inventDimCriteria).reservPhysical().parmInventQty()
/* This method checks the source text for calls to InventSum methods that should not be called see http://blogs.msdn.com/b/dynamicsaxscm/archive/2014/05/05/upgrading-code-that-relies-on-available-and-reserved-inventory-quantities-in-ax-2012-r3.aspx */ protected boolean CheckObsoleteInventSum() { xRefTmpReferences thisRefererences; boolean ret = false; Map deprecatedFields = new Map(Types::String, Types::String); Map deprecatedMethods = new Map(Types::String, Types::String); deprecatedFields.insert('AvailOrdered', 'InventIAvailability.availTotal()'); deprecatedFields.insert('AvailPhysical', 'InventIAvailability.availPhysical()'); deprecatedFields.insert('Ordered', 'InventIAvailability.ordered()'); deprecatedFields.insert('ReservOrdered', 'InventIAvailability.reservOrdered()'); deprecatedFields.insert('ReservPhysical', 'InventIAvailability.reservPhysical()'); deprecatedMethods.insert('availOrderedCalculated','InventIAvailability.availTotal()'); deprecatedMethods.insert('availPhysicalCalculated','InventIAvailability.availPhysical()'); deprecatedMethods.insert('availReservation','InventIAvailability.availReservation()'); deprecatedMethods.insert('orderedSum','InventIAvailability.orderedSum()'); // check if things are used, that are being superseed by something new thisRefererences.setTmpData(tmpxRefReferences); while select thisRefererences where thisRefererences.ParentName == 'InventSum' && (thisRefererences.Kind == xRefKind::TableInstanceMethod || thisRefererences.Kind == xRefKind::TableField) { switch (thisRefererences.Kind) { case xRefKind::TableInstanceMethod: if ( deprecatedMethods.exists(thisRefererences.name) ) { ret = true; sysBPCheck.addError(#BPErrorMethodDiscontinuedInLaterVers, thisRefererences.Line, thisRefererences.Column, strFmt("@SYS68910", thisRefererences.ParentName, (thisRefererences.Kind == xRefKind::ClassInstanceMethod || thisRefererences.Kind == xRefKind::TableInstanceMethod || thisRefererences.Kind == xRefKind::MapInstanceMethod) ? '.' : '::', thisRefererences.Name, deprecatedMethods.lookup(thisRefererences.name))); break; } case xRefKind::TableField: if ( deprecatedFields.exists(thisRefererences.name) ) { ret = true; sysBPCheck.addError(#BPErrorMethodDiscontinuedInLaterVers, thisRefererences.Line, thisRefererences.Column, strFmt("@SYS68910", thisRefererences.ParentName, '.', thisRefererences.Name, deprecatedFields.lookup(thisRefererences.name))); break; } } } return ret; }Modify \Classes\SysBPCheckMemberFunction\check and add to the end:
this.CheckObsoleteInventSum();
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics AX.
Authors are allowed to set their own AdSense units.
Join us.