Skip to main content

Posts

Showing posts from March, 2021

Converting item type in D365 through code

 Well recently I came across an issue where user had created more than 100 items in productions with wrong type. The standard out of the functionality does not allow to convert the item type if its released. Deleting is also not possible. So we are stuck with an option of disabling the item and creating new once with correct type. But the limitation here is than we would have to come with new sku code where its similar to original code but not exact as it is used. So I wrote the code convert the item type through X++ which resolved our issue. Below is the code to perform this task. I am using csv file to bulk update the items and changing item type from service to item in this example. public static void main(Args _args) {         AsciiStreamIo                                   file;         Array                                           fileLines;         FileUploadTemporaryStorageResult                fileUpload;         InventTable invt;         EcoResProduct e