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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Function LedgerDimensionDefaultingEngine::constructForMainAccountId has been incorrectly called

(0) ShareShare
ReportReport
Posted on by 2
can someone help with this issue , i have checked main account id is asolutely correct 
         container                           dimCon = str2con(/92302-101/, /-/);               List listValueContract = new List(Types::Class);        // Depsrtments        if(conPeek(dimCon, 2) != //)        {            valueContract = new DimensionAttributeValueContract();            valueContract.parmName(/Fund/ );            valueContract.parmValue(conPeek(dimCon, 2));            listValueContract.addEnd(valueContract);        }                 accountContract     = new LedgerAccountContract();        accountContract.parmMainAccount(conPeek(dimCon, 1));        accountContract.parmValues(listValueContract);               validationContract  = new LedgerAccountValidationContract();        validationContract.parmLedgerAccount(accountContract);        validationContract.parmValidDate(systemDateGet());        dimensionStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(accountContract);        validationStatus = LedgerDimensionValidationHelper::validateByTreeForCombination(DimensionStorage, today(), true, false ,false);        Info(strFmt(/%1/,validationStatus))  ;    }
 
I have the same question (1)
  • Martin Dráb Profile Picture
    238,883 Most Valuable Professional on at
    What do you need from us? It seems that the title meant to mention an error. Use the debugger to find out more about it, such as the call stack and the condition check if the exception should be thrown. Then you may be able to understand the problem. If you still need our help, share the collected information with us.
     
    To make it easier for other, let me re-post your code.
    container dimCon = str2con('92302-101', '-');
    List listValueContract = new List(Types::Class);
    
    // Departments
    if (conPeek(dimCon, 2) != '')
    {
        valueContract = new DimensionAttributeValueContract();
        valueContract.parmName('Fund');
        valueContract.parmValue(conPeek(dimCon, 2));
        listValueContract.addEnd(valueContract);
    }
    
    accountContract = new LedgerAccountContract();
    
    accountContract.parmMainAccount(conPeek(dimCon, 1));
    accountContract.parmValues(listValueContract);
    
    validationContract  = new LedgerAccountValidationContract();
    validationContract.parmLedgerAccount(accountContract);
    validationContract.parmValidDate(systemDateGet());
    
    dimensionStorage = DimensionServiceProvider::buildDimensionStorageForLedgerAccount(accountContract);
    validationStatus = LedgerDimensionValidationHelper::validateByTreeForCombination(dimensionStorage, today(), true, false, false);
    info(strFmt("%1", validationStatus));
     
    I see just a part of a bigger piece of code; not something we could run and test. That makes it harder for us help you.
     
    By the way, make sure you don't hard-code '-' in your production code. The delimiter is configurable.
  • Sachin Mittal Profile Picture
    2 on at
    i have debugged ,  mainaccountid exists still its throwing error on this function
  • Martin Dráb Profile Picture
    238,883 Most Valuable Professional on at
    Then the empty parameter must be _accountingStructureId.

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 518 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 431

#3
Adis Profile Picture

Adis 280 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans