web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Fixed ledger dimension in D365

(0) ShareShare
ReportReport
Posted on by 480

I´m developing an integration solution in D365 but I have problem with the ledger dimensions. It works fine to create the records in LedgerJournalTrans and the field ledgerDimension gets a value but if there is a a fixed value set on one of the main account it is never set. I have tried to explain my code below. The dimension values are added to a container and past on to LedgerDimensionDefaultingEngine together with Main account and Dimension Hierarchy. Sometimes dimension2 is not set from the file, then it should be set from a Fixed value instead but that is not working.

    // runable Job

    public static createDimensionJob(Args _args)
    {  
    container con;
    str 10                  dimension1 = "first";
    str 10                  dimension2 = "second";
    str 10                  dimension3 = "third";
   
    DimensionDefault defaultDimension;
    recId mainAccountRecId;
    recId dimHierarchyId;
    LedgerDimensionAccount ledgerDimensionAccount;
    LedgerJournalAC ledgerAccount = "1234";

    con = conIns(con, 1, dimension1);
    con = conIns(con, 2, dimension2);
    con = conIns(con, 3, dimension3);
          
    mainAccountRecId = MainAccount::findByMainAccountId(ledgerAccount).RecId;
    defaultDimension = MyClass::createDefaultDimension(con);
    dimHierarchyId = MyClass::getDimensionHierarchyId(ledgerAccount, defaultDimension);
   
    ledgerJournalTrans.LedgerDimension = LedgerDimensionDefaultingEngine::getLedgerDimensionFromAccountAndDim(mainAccountRecId, dimHierarchyId, defaultDimension);
    }
 
    //MyClass

    public static recId createDefaultDimension(container _conDimAttrValues)
    {
        DimensionFinancialTag               dimFinancialTag;
        FinancialTagCategory                tagCategory;
        DimensionAttributeDirCategory       dimAttrDirCategory;
        DimensionAttribute                  dimAttr;
        DimensionAttributeValue             dimAttrValue;
        DimensionAttributeValueSetStorage   dimAttrValueSetStorage;
        int                                 i;
        str 10                              strDimAttrValue;

        // Create storage
        dimAttrValueSetStorage = new DimensionAttributeValueSetStorage();

        for (i = 1; i<=conLen(_conDimAttrValues); i++)
        {
            strDimAttrValue = conPeek(_conDimAttrValues,i);

            if (strDimAttrValue)
            {
                // Find FinancialTag
                select firstonly RecId
                    from dimFinancialTag
                    where dimFinancialTag.Value == strDimAttrValue
                    join RecId from tagCategory
                        where tagCategory.RecId == dimFinancialTag.FinancialTagCategory
                    join RecId from dimAttrDirCategory
                        where dimAttrDirCategory.DirCategory == tagCategory.RecId
                    join dimAttr
                        where dimAttr.RecId == dimAttrDirCategory.DimensionAttribute;

                // Add to storage
                if (dimFinancialTag.RecId)
                {
                    dimAttrValue = DimensionAttributeValue::findByDimensionAttributeAndValue(dimAttr, strDimAttrValue);

                    if (dimAttrValue.RecId)
                    {
                        dimAttrValueSetStorage.addItem(dimAttrValue);
                    }
                }
            }
        }

   

*This post is locked for comments

I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Volodya Profile Picture

Volodya 2

#2
tgudwanski Profile Picture

tgudwanski 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans