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();
If you found value in what I share, I've set up a Buy Me a Coffee page as a way to show your support.
Buy Me a CoffeeNo comments. Be the first one to comment on this post.
DaxOnline.org is free platform that allows you to quickly store and reuse snippets, notes, articles related to Dynamics 365 FO.
Authors are allowed to set their own "buy me a coffee" link.
Join us.