Skip to main content

Posts

Showing posts from 2021

D365 Remove contact or update contact information

We all come across the requirements where the contact information for the customer is entered in a wrongly manner or there's whole set of records where the information provided is completely garbage. For me it was Email and Mobile. So we extracted data and narrowed it down to list of customers with garbage values. For this I have prepared one csv file mainly consisting four columns. 1) Account 2) Garbage info Email/Mobile 3) Identifier Email/Mobile 4) Add for modifying existing number. Below is the code to call the same from RunnableClass class CustomerDataCleanupEmailAndPhone {     /// <summary>     /// Runs the class with the specified arguments.     /// </summary>     /// <param name = "_args">The specified arguments.</param>     public static void main(Args _args)     {         #define.LocationRoleName('Collection')         AsciiStreamIo                                                                 file;         Array                 

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