1

I have a requirement, where I need to create a form to display sales order details along with Business Unit. I tried all the tables, but not able to figure out how can I get Business Unit for that Sales Id. Can some one please help?

I have salesId, but I am not able to find the related Business Unit defined on the sales order form.

Path for Business Unit: Line Details > Default Financial Dimensions > Business Unit.

Jonathan Bravetti
  • 2,228
  • 2
  • 15
  • 29
Raj
  • 85
  • 14

1 Answers1

1

If you need to show on your form standard financial dimension control like that enter image description here

then you can follow this step by step guide How add financial dimension on forms inside Ax2012

Just skip first point because SalesTable already has DefaultDimension field.

But if you need to find record in General ledger > Setup > Organization > Business units then you can use this piece of code

DimensionAttributeValueSetStorage    dimStorage;    
DimensionValue                       dimensionValue;
DimensionDefault                     defaultDimension;
int                                  i;
;

defaultDimension = SalesTable.DefaultDimension; 
dimStorage = DimensionAttributeValueSetStorage::find(defaultDimension);

for (i = 1; i <= dimStorage.elements(); i++)
{
    if (DimensionAttribute::find(dimStorage.getAttributeByIndex(i)).Name == 'BusinessUnit')
    {
        dimensionValue = dimStorage.getDisplayValueByIndex(i);
        break;
    }
}

dimensionValue holds Operation unit number and using this value you can find record in Business units (OMOperatingUnit) table.

Aliaksandr Maksimau
  • 2,251
  • 12
  • 21