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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

Validate ledger dimension against account structure through x++

(0) ShareShare
ReportReport
Posted on by

Hi All,

I have a ledger dimension which I want to validate against an account structure in my code, can you please suggest if I can do that and how.

Cheers!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    dolee Profile Picture
    11,279 on at

    Hi,

    Please try this:

    static void ValidateLedgerDimension(Args _args)

    {

       str mainAcctNum = "110130";

       LedgerAccountValidationContract validationContract;

       LedgerAccountContract           accountContract;

       DimensionAttributeValueContract valueContract;

       FinancialDimensionValidationService service;

       List listValueContract = new List(Types::Class);

       // Business Unit

       valueContract = new DimensionAttributeValueContract();

       valueContract.parmName("BusinessUnit");

       valueContract.parmValue("002");

       listValueContract.addEnd(valueContract);

       // Department

       valueContract = new DimensionAttributeValueContract();

       valueContract.parmName("Department");

       valueContract.parmValue("028");

       listValueContract.addEnd(valueContract);

       accountContract = new LedgerAccountContract();

       accountContract.parmMainAccount(mainAcctNum);

       accountContract.parmValues(listValueContract);

       validationContract = new LedgerAccountValidationContract();

       validationContract.parmLedgerAccount(accountContract);

       validationContract.parmValidDate(systemDateGet());

       service = new FinancialDimensionValidationService();

       if (service.validateLedgerAccount(validationContract))

       {

           info("Valid");

       }

       else

       {

           info("Invalid");

       }

    }

  • Verified answer
    Kumar Gaurav @ MS Profile Picture
    on at

    Thanks for the response Dominic,

    I found a way to do it by following code

    DimensionValidation::validateByTree(ledgerDimensionRecId,today(),true)  

    I didn't needed to go into service which I am sure will be required in other complex scenarios

  • Suggested answer
    Community Member Profile Picture
    on at

    Thank you Dominic,

    I use one transaction with two items and a financial dimension that is different, but I get a bug like this

    Function DimensionDefaultingEngine::insertDimensionSpecifer has been incorrectly called.

    help me

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Kumar,

    Coding can be divided in this way,

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans