Friday, 24 June 2016

Change or Create Dimension for a particular Customer

Change or Create Dimension for a particular Customer: 

The below is the job to either create or modify customer dimensions...

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

  struct.add('Department', '00000031');
    struct.add('CostCenter', 'OU_3566');
  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('1101', true);   //1101 is Customer
  custTable.DefaultDimension = DimensionDefault;


1 comment:

Excel data connector in AX7/D365

Excel data connector in AX7: Configuring and using the Excel Data Connector Add-in The Excel Data Connector add-in is built by usi...