Today I was facing a strange problem. I use ledger entry for customer code which was freely available on different blog. You can find the same code here, which I used it two years ago.
This code will work perfectly fine. We create ledger entry for different customer and our customization is working fine. But when we create ledger entry for newly created customer. Ledger entry successfully created but customer account was not populated. More interestingly if we create or manually update same ledger entry for same customer account, the rest of customization works fines for same customer.
When I struck and no way out, I queried to NDA AX group, Only André Arnaud de Calavon
Replied with hint. Problem was that Customer account must exist in DimensionAttributeValueCombination.
When we create a ledger entry first time for customer, Ax create first customer entry in DimensionAttributeValueCombination table. Then go for Ledger entry.
After writing code, searched finally I found that following statement works for me.
This statement, search Ledger dimension, if found it will return otherwise will create and return.
Why I love Dynamics Ax, Because, ERP is so vast that every day new challenge and every day something new for learning.