Let's walk through creating a standard Build VM
You are here
Clean up Production Order Journals
Let's Clean Up Production order Journals!
Production Orders have various journals that post with the order as it works through its lifecycle such as picking list, route card and report as finished journals. Periodically, it's a good idea to clean these out once a production order has been ended. There is some built in functionality to help with this now.
In Production Control > Periodic > Clean up, look for Production Journals cleanup. This will let you remove posted production journals. this will run for either all posted journals or all posted journals on ended production orders. I suggest you run this only for all posted journals on ended productions. One thing that isn't clear is that ended production orders can also be deleted and the option to run this for "all posted journals on ended production orders", despite the name, will only look at journals where the production order for that journal has been deleted. Also, depending on what reporting may be in place, this may remove some info for currently in progress production orders that may be of use outside of AX. This process will remove all header records for picking list, route / job card and report as finished journals type journals from the production journal table (ProdJournalTable) with business logic and alerts disabled. Next, it will identify all related journal lines in BOM journal Transactions (ProdJournalBOM) [and ProdJournalBOM_IN], routing journal transactions (ProdJournalRoute) [ and Project routing journal transactions (ProdJournalRouteProj) ] , and Production journal transactions (ProdJournalProd) and delete all records ( and locationization related records, if applicable ) with business logic and alerts disabled.
Dynamics 365 for Finance and Supply Chain
Functionally, this is the same and can be found in the same place. However, this has an updated delete routine for the "All Posted" clean up option. This bypasses scoping a PordJournalTable buffer then using a delete_from to delete ProdJournalTable records. This using the following to execute direct SQL.
SysDaQueryObject deleteQuery = new SysDaQueryObject(prodJournalTable);
deleteQuery.whereClause(new SysDaEqualsExpression(new SysDaFieldExpression(prodJournalTable, fieldStr(ProdJournalTable, Posted)), new SysDaValueExpression(NoYes::Yes)));
Take a look at class ProdJournalCleanUp for more info.