1
votes

I'm posting to a general journal in ax 2012. I'm able to create the journal and enter most line information from x++ code. Now i'm having an issue with some vendor numbers.

When I use this code most of the time it works. But there are a few vendor numbers that are not able to be found from this table and of course throws an error. Weird thing is if I actually go into ax and type in the vendor number it does accept it because it has been setup in the system but by this code it is not working (for some).

Just wondering if there is something wrong with how the vendor number is setup, properly not linked with something, or if there is another way to properly set this parameter.

It looks like parmledgerDimension uses a RecId for vendors and only pulls it from DimensionAttributeValueCombination.

Any ideas?

DimensionAttributeValueCombination  davc;
firstonly RecId from davc where davc.DisplayValue == account; //could be 010-000001
journalTrans.parmLedgerDimension(davc.RecId);
1
I think the DimensionAttributeValueCombination only has a record for a dimension (in this case the vendor number) if the dimension has been used in a transaction. So check if the vendors for which this code fails have any transactions. - FH-Inway
Ok, Its weird though how else do you set the parameter parmLedgerDimension because it seems like it uses a recid only from that table. i'm wondering how if you setup a vendor id for the first time, shouldn't it get updated in that table some how? are you saying once there is a 'transaction' with that vendor id , it will then be in that table. can you explain exactly what you mean by the term transaction in regards for this to work. i'm new to ax - Sirus
also these vendor numbers are relatively new ones.. all the older ones seem to work fine.. - Sirus
Basically if the vendor has been used in any process, table DimensionAttributeValueCombination should contain an entry for the vendor. I would suggest creating a purchase order for the vendor and do some postings with it. After each step, check if DimensionAttributValueCombination contains a record for the vendor. After you have identified a process that creates such a record, you could debug it and find out how the record is created. Then you could extract the relevant code to create the record on your own without the process. - FH-Inway
Its funny though, i created a vendor and didn't use any transactions on it.. just like any other vendor is created. The entry gets inserted in the dimensionsAttributeValueCombination table without doing anything. I run my x++ code to verify and it returns the recid. Its just wierd with these other two why... i'm not sure whats different.. maybe its some security issue or something i'm missing how its setup.. - Sirus

1 Answers

3
votes

Try using

DimensionStorage::getDynamicAccount(account, LedgerJournalACType::Vend);

https://msdn.microsoft.com/en-us/library/dimensionstorage.getdynamicaccount.aspx

Edit: the first line I posted was to get the default dimension. I'll leave it in case you need it

LedgerJournalEngine::getAccountDefaultDimension(account, curext(), LedgerJournalACType::Vend);

https://msdn.microsoft.com/en-us/library/ledgerjournalengine.getaccountdefaultdimension.aspx