AX 2012 - Items & InventItemSetupSupplyType Table
In past post, I've covered the usage of services for performing operations external to AX, as well as internal.
Some examples that have done recently, were focused around Creating Products in AX 2012, via the EcoResProductService.
As well as creating the new Trade Agreements, via PricePriceDiscJournalService.
The point that I've tried to get across in these examples, is to show how this can be done within AX 2012, as well as the same concepts and constructs can be used externally of AX 2012. This is the right move, specifically if your looking beyond AX 2012, and beyond AX7 even.
With this concept, you can also Release Products to a specific legal entity, which is covered pretty well, via a C# example, found at the following resource.: Product-item data management services.
So again, we see how both X++ and C# can use these constructs, Document Services, to create products, as well as release them to a specific legal entity. With this said, there is something missing, for this process.
Specifically, if we look to have our migrated products, that have been released, to show up on the Purchase Order Lines, Item Id field drop down. If we go to do this, and we created products, and released them for use within a specific legal entity, via the services described in the above references, then our items would not show up for use on Purchase Order lines. They can be entered, but do not show up.
The reason this is the case, is because in AX 2012, the Purchase Order Line, Item Id datasource field, has a new lookup() form it uses, called InventItemIdLookupPurchase. This form, has a datasource, that includes the new table: InventItemSetupSupplyType. [InventItemSetupSupplyType Table [AX 2012]]
This new table, contains sourcing information, related to the Item that is being released to a specific legal entity. When this release takes place, the AX Rich Client UI, will fire the EcoResProductReleaseManager object that has logic which creates a default entry into the InventItemSetupSupplyType table, with a Default Order Type of Purchase.
When creating products and releasing them through the services, specifically for the InventItemService, [InventItemService Class [AX 2012]], it makes use of the AxdItem Query object in AX 2012, in order to create records via.
Since this is the case, and we can see from above that the InventItemSetupSupplyType table does not exists as a datasource, then when creating records via this design concept, will not satisfy the requirement of adding entries into the new table, of InventItemSetupSupplyType.
Therefore, there is a small disconnect between the UI release process, and the document service approach for creating and releasing items. This is a simple fix however, either invoke similar code, found in the EcoResProductReleaseManager class for the createInventItemSetupSupplyType() method. Or the other option, could be to add the datasource, to the AxdItem query, for the InventItemSetupSupplyType table, and regenerate the InventItemService, document service, so it will reflect the new entity within it's WSDL.
Depending on the scope of what your doing, should guide you on which choice you make here. If it's throw away, migration code, the simple, fast option of just invoking the X++ code that lives within the EcoResproductReleaseManager class would be advised.
However, if your doing a longer, value add modification, or integration, then, looking to modifying the InventItemService, via the AxdQuery object should be considered.
Well I know that's a little deep dive, on something very specific, however such deep dives are warranted at times. I believe, it's important to understand this, from a process point of view, but also see the value in showing choice. The ability to solve a need, there is multiple ways. Depending on where the most value is, should guide your choice, for the design and the development of answering a specific scope need.
That's all for now, but check back soon as a whole lot more to come. Till next time!