how to create code for combination value in AX2012

Hi all…

Need some help,
do u have create for combination value in ax before?
Currently i am using AX2012

now i create customization for main account in a table and i want use that main account for combination, also that i use this code :

LedgerDimensionAccount ledgerDim;
DimensionAttributeValueCombination tblComb;
DimensionServiceProvider DimensionServiceProvider = new DimensionServiceProvider();
LedgerAccountContract LedgerAccountContract = new LedgerAccountContract();
DimensionAttributeValueContract ValueContract;
List ListValueContract = new List(Types::Class);
DimensionStorage dimStorage;

str _ledgerAccount = conPeek(_ConValueCom, 1);
str _group = conPeek(_ConValueCom, 2);
str _dimension = conPeek(_ConValueCom, 3);

if (_group)
{
ValueContract = new DimensionAttributeValueContract();
ValueContract.parmName(‘VendGroup’) ;
ValueContract.parmValue(_group);
ListValueContract.addEnd(ValueContract);
}

if (_dimension)
{
ValueContract = new DimensionAttributeValueContract();
ValueContract.parmName(‘Pusat’) ;
ValueContract.parmValue(_dimension);
ListValueContract.addEnd(ValueContract);
}

LedgerAccountContract.parmMainAccount(_ledgerAccount);
LedgerAccountContract.parmValues(ListValueContract);

dimStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(LedgerAccountContract);

tblComb = DimensionAttributeValueCombination::find(dimStorage.save());

***i got the error when ‘parmMainaccount’ which is the “main account is not exist”.

and my question is,how can I call the main account from table customization that i create?

Kindly advice,
thanks in advance :slight_smile:

hi ,

u should use the ledger dimension field to get the main account.

thanks,

srikanth

the ledger dimension is from which table?

Thanks for your reply,

just now the main account is already done.
but i got error which is " Unable to return DimensionAttributeValue record (VendGroup)"