The CostSheetCache table which is used as a temp location for cost sheets to help generate prices is not cleared automatically in AX
unless you tell it to. So it can become very large inside of your DB (sometimes 10-30GB+) There are two ways you can clear out this information properly to keep this table small in size.
1.) Manually trigger the clearing inside of AX (this is the only way I know how to do it via default AX)
Go to Production Control / Setup / Routes / Cost Groups Modify any record on this form and it will trigger the cleanup whenever you close the form.
2.) Create a job with the following code.
static void CostSheetCacheClear(Args _args)
{
//this will clear the table CostSheetCache
CostSheetFactory::construct().clearCachedData();
info("Cleared the table CostSheetCache");
}
This is the same code that gets triggered in step 1 and can be found on
\Tables\BOMCostGroup\insert(), update(), delete()
1.) Manually trigger the clearing inside of AX (this is the only way I know how to do it via default AX)
Go to Production Control / Setup / Routes / Cost Groups Modify any record on this form and it will trigger the cleanup whenever you close the form.
2.) Create a job with the following code.
static void CostSheetCacheClear(Args _args)
{
//this will clear the table CostSheetCache
CostSheetFactory::construct().clearCachedData();
info("Cleared the table CostSheetCache");
}
This is the same code that gets triggered in step 1 and can be found on
\Tables\BOMCostGroup\insert(), update(), delete()
Dear Adam, for your script what kind of job , TSQL or activeX script.
ReplyDeleteand if we running this script is there no impact with costing data
The example listed above is a job within the AOT. However we found that once this table was 20+GB it took forever to run.
ReplyDeleteSo we started to make it a maintenance task during code deployments to clear the table via SQL (as a truncate table sql command which is a lot faster and does the same thing) then restart the aos.
Dear Adam,
ReplyDeleteThank you...!!
My Problem was solved....!!