Reputation: 85
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.
Upvotes: 1
Views: 1461
Reputation: 2281
If you need to show on your form standard financial dimension control like that
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.
Upvotes: 1