Making Cross-Company Tables in AX Semi-Company Aware
When using AX, there are a lot of times where you want data to go across companies, but still need some records to be company specific. The easiest way to accomplish this is by creating a cross-company table in AX. You would do this by first setting the to-be, non-company specific with the below metadata (circled in red):
You would then add a field called “CompanyID” or something similar. I would highly recommend against using DataAreaID. Then on the table you would add a find method that would take the key fields. The find should look something like this:
public static <Table> find(Key1 _key1, Key2 _key2, etc., boolean _update = false) { <Table> table; table.selectForUpdate(_update); select table where table.CompanyID == curext() && table.Key1 == _key1 … etc if (!table) { select table where table.Key1 == _key1 … etc } return table; }