Disabling particular financial dimension based
on record or on particular form quite tricky in AX 2012 compared to AX 2009.
Here is an example to achieve disabling Business unit
financial dimension on Customers form in AX 2012.
Process to disable Business Unit financial dimension on
Customers form.
1. Create
a new parm method in ‘DimensionDefaultingControllerBase’ class as shown below
void parmEditableDimensionAttributeSetId(RefRecId
_editableDimensionAttributeSetId =
editableDimensionAttributeSetId)
{
editableDimensionAttributeSetId = _editableDimensionAttributeSetId;
}
2. Create
a new method in ‘CustTable’ form as shown below
private void
setDimensionAttributeSetStorage()
{
DimensionAttribute dimAttr;
DimensionAttributeSetItem
dimAttrSetItem;
DimensionEnumeration
dimensionSetId =
DimensionCache::getDimensionAttributeSetForLedger();
DimensionAttributeSetStorage
dimensionAttributeSetStorage;
;
dimensionAttributeSetStorage
= new
DimensionAttributeSetStorage();
while select
* from dimAttr
order by
Name
where dimAttr.Type !=
DimensionAttributeType::MainAccount
join RecId from
dimAttrSetItem
where dimAttrSetItem.DimensionAttribute ==
dimAttr.RecId &&
dimAttrSetItem.DimensionAttributeSet == dimensionSetId
{
if (dimAttr.Name != 'BusinessUnit')
// Except BusinessUnit rest should enable
dimensionAttributeSetStorage.addItem(dimAttr.RecId,
dimAttr.HashKey,NoYes::Yes);
}
dimensionDefaultingController.parmEditableDimensionAttributeSetId(dimensionAttributeSetStorage.save());
}
3. Add
below highlighted code in ‘init’ method of ‘CustTable’ form as shown below
Calling newly created method
before dimensionDefaultingController.pageActivated();
dimensionDefaultingController =
DimensionDefaultingController::constructInTabWithValues(true, true,
true, 0,
this, tabFinancialDimensions, "@SYS138487");
dimensionDefaultingController.parmAttributeValueSetDataSource(custTable_ds,
fieldStr(CustTable,
DefaultDimension));
// Added by Shankar on 25/11/2013 DisableFinDimensions -
Begin
this.setDimensionAttributeSetStorage();
// Added by Shankar on 25/11/2013 DisableFinDimensions -
End
dimensionDefaultingController.pageActivated();
4. Now
open Customers form & check financial dimensions tab it shows as below.
Can see Business Unit financial dimension disabled,
highlighted one.
Hope this topic would be helpful...Enjoy...
I want to display only 2 dimension and that too only with the first part(i.e. I dont want to show the default value screen in the fast tab.
ReplyDeleteIs that possible shankar ?
Hi Vikas,
DeleteGo through the below link... Hope you are looking same kind of....
http://shankardynamicsax.blogspot.ae/2014/04/only-show-required-financial-demensions.html
Thanks, very usefull.
DeleteIs there a way to display only the active (i.e. not suspended) values in a dimension drop-down box? The dimension controller eventually validates a suspended entry bu if would be a much cleaner U.I. if we could propose to the user only the active choices.
ReplyDeleteRegards,
Eric
Hi Shankar,
ReplyDeleteis this is possible to do the same as like mandatory on the form rather than creating please reply asap
Sorry, I didn't get what you are looking for...
DeleteCould you elaborate your requirement...
Regards,
Shankar
Hello Shankar,
ReplyDeleteDear All,
I wanted to show only limited dimension on some forms. I did all the things as per your blog(http://shankardynamicsax.blogspot.in/2013/11/disable-financial-dimensions-in-ax-2012.html & http://shankardynamicsax.blogspot.in/2014/04/only-show-required-financial-demensions.html). It worked fine for CustTable, VendTable and SalesTable forms.
But for PurchTable form, it is not working.
When I called the method parmEditableDimensionAttributeSetId() with both the object(dimensionDefaultingControllerLine & dimensionDefaultingControllerHeader), the purchTable form was not responding properly.
dimensionDefaultingControllerLine.parmEditableDimensionAttributeSetId(dimensionAttributeSetStorage.save());
dimensionDefaultingControllerHeader.parmEditableDimensionAttributeSetId(dimensionAttributeSetStorage.
But when I called the method parmEditableDimensionAttributeSetId() with object dimensionDefaultingControllerLine only, it was working fine for only LineView mode.
dimensionDefaultingControllerLine.parmEditableDimensionAttributeSetId(dimensionAttributeSetStorage.save());
What to do to show only limited dimension on both the view(LineView & HeaderView) of PurchTable form?
Note: In SalesTable form, there are also two object(dimensionDefaultingControllerLine & dimensionDefaultingControllerTable). I called the method parmEditableDimensionAttributeSetId() using both the Object, it is working fine.
https://erpdax.wordpress.com/2016/03/08/disable-financial-dimensions-in-ax-2012-through-code/
ReplyDelete