Тема
:
sumitsaxfactor: Defaulting Ledger Dimensions [AX 2012]
Показать сообщение отдельно
29.12.2011, 01:12
#
1
Blog bot
Участник
25,646
/
848
(
80
)
Регистрация: 28.10.2006
sumitsaxfactor: Defaulting Ledger Dimensions [AX 2012]
Источник:
http://sumitsaxfactor.wordpress.com/...sions-ax-2012/
==============
In my earlier post, I had described a way to default financial dimensions through code. In this post, I will describe about the way we can default Ledger Dimensions (DimensionAttributeValueCombination) through code.
We have seen how we can fetch the values from a dimension combination in my post
here
. But what if we have to default them using code.
Say you are creating a general journal and want to default the Account and Offset account fields. These fields have been changed to segmented controls and now store RecIds for DimensionAttributeValueCombination table.
The job below will help you in doing that.
Below are the screen shots of dimensions for the two record ids used below:
static
void
setLedgerDimensions(Args _args)
{
LedgerDimensionAccount ledgerDimension;
// Record id for LedgerDimension(DimensionAttributeValueCombination) containing combination of dimensions
LedgerDimensionAccount mainAccDimension;
// Record id for LedgerDimension(DimensionAttributeValueCombination) containing default account for main account RecId
RefRecId emplDimAttrRecId =
5637147951
;
// For ex. purpose defaulting it to required DimensionAttributeValueSet RecordId
RefRecId dimensionRecId =
5637145941
;
// For ex. purpose defaulting it to required DimensionAttributeValueSet RecordId
;
/*
* For information on finding the record ids for required dimension combinations
* Go through the following blog
*
http://sumitsaxfactor.wordpress.com/2011/12/28/defaulting-financial-dimensions-ax-2012/
*/
// Get the default account for main account 110154
mainAccDimension = DimensionStorage::getDefaultAccountForMainAccountNum(
"110154"
);
//Find or create the LedgerDimension record for required combination
//Param1 – Ledger Dimension record id, in our case Default account for main account
//Param2 – Default Dimension Record Id for 1st Dimension Combination
//Param3 – Default Dimension Record Id for 2nd Dimension Combination
//Param4 – Default Dimension Record Id for 3rd Dimension Combination
ledgerDimension = DimensionDefaultingService::serviceCreateLedgerDimension(
mainAccDimension,
dimensionRecId,
emplDimAttrRecId);
info(
strFmt
(
"%1: %2"
, ledgerDimension, DimensionAttributeValueCombination::find(ledgerDimension).DisplayValue));
}
This is the output
Источник:
http://sumitsaxfactor.wordpress.com/...sions-ax-2012/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите
личное сообщение
администратору.
Blog bot
Посмотреть профиль
Найти ещё сообщения от Blog bot