Configurations to check when batch jobs don’t work in #AX2012

If your batch job is not executing the first few things you should check before anything else are shown in the video below:





Shrinking a Database Log file through SQL

Often our DB logs grow out of hand and we are left with limited space; a common occurrence on dev boxes for AX. So among other remedies to get more space is shrink your database log files and you can do so by using the queries below. Make sure you back up your databases before you run this, make this a standard practice before changing/modifying any meta on your db servers. You can do this for both your trans and model databases for Dynamics AX 2012.

USE DynamicsAXDev_model;


— Truncate the log by changing the database recovery model to SIMPLE.

ALTER DATABASE DynamicsAXDev_model



— Shrink the truncated log file to 1 MB.

DBCC SHRINKFILE (DynamicsAXDev_model_Log, 1);


— Reset the database recovery model.

ALTER DATABASE DynamicsAXDev_model



AX Tables updated when a Pending Vendor Invoice is Posted inside #AX2012

An invoice when posted goes into the following tables:

For Invoice Header:

VendInvoiceJour defaults from VendInvoiceInfoTable

For Invoice lines:

VendInvoiceTrans defaults are from VendInvoiceInfoline table

See bttom to top:

Then a single record is inserted in VendTrans then VendTransOpen, see bottom to top

Change or Remove a dimension value on an Item through X++ in AX 2012

Using the below job you can update dimension values on an item.


static void UpdateDepartmentMISC_Items(Args _args)

InventTable inventTable;
DimensionAttributeValueSetStorage dimStorage;
DimensionAttribute dimAttDept, dimAttMisc;
DimensionAttributeValue dimAttributeValueDept, dimAttributeValueMisc;

DataAreaId company;
str misc, dept;
ItemId itemId;
int counter = 0;


info(strFmt('Start time: %1', time2StrHM(timeNow())));



inventTable = null;

dimStorage = null;

dimAttMisc = null;

dimAttDept = null;

dimAttributeValueDept = null;

dimAttributeValueMisc = null;

while select forUpdate inventTable

where inventTable.ItemId == itemId

&& inventTable.dataAreaId == curext()






dimStorage = DimensionAttributeValueSetStorage::find(inventTable.DefaultDimension);

dimAttDept = DimensionAttribute::findByName(#DepartmentDimensionToUpdate);

dimAttMisc = DimensionAttribute::findByName(#MISCDimensionToUpdate);

dimAttributeValueDept = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttDept, dept, true, true);


if (misc)


dimAttributeValueMisc = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttMisc, misc, true, true);





inventTable.DefaultDimension =;






error(strFmt("Error to update dimension for item %1", inventTable.itemid));





info(strFmt("Records updated: %1", Counter));

info(strFmt('End time; %1', time2StrHMS(timeNow())));


Tip for adding an element to an existing Base enum in AX 2012

Witnessed a scenario where an isv solution had modified an existing sys enum to add more values for its use and new elements value  was only increased by +1. This is a bad design practice and can cause issues further down the road when its time for an upgrade and Microsoft adds new elments to that enum so you do not want to be in that situation. Therefore the best practice is to add your element with a value that starts with +100.

So for example i have this ABC enum and its C element’s Enum value is 3:



If my customization requires me to add values to this I should start at 103:


This will prevent any future upgrade conflicts that can be a nightmare for someone doing an upgrade.