Customer/Vendor Default Financial Dimensions - ax 2012

Hi all,

I am trying to create code for assigning default financial dimensions for customers or vendors (default department and cost center) but I only find complex ways of make this thing that should be quite easy to do.

Could one provide an example code for assigning a default value to a dimension?


I think I found an easy one for my case:

static void setDefaultDimensionToCustomer(Args _args)
CustTable custTable;
Struct struct = new Struct();
container ledgerDimension;
DimensionDefault DimensionDefault;

struct.add(‘Abteilung’, ‘02’);
struct.add(‘Kostenstellen’, ‘00200’);
ledgerDimension += struct.fields();
ledgerDimension += struct.fieldName(1);
ledgerDimension += struct.valueIndex(1);
ledgerDimension += struct.fieldName(2);
ledgerDimension += struct.valueIndex(2);

DimensionDefault = AxdDimensionUtil::getDimensionAttributeValueSetId(ledgerDimension);
custTable = CustTable::find(“22027”, true);
custTable.DefaultDimension = DimensionDefault;

Why are you not configuring the customers with these dimensions - or is the point you get the system to assign these based upon the creation data?