Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Unanswered

Function LedgerDimensionDefaultingEngine::constructForMainAccountId has been incorrectly called

Posted on by 490
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))  ;    }
 
  • Martin Dráb Profile Picture
    Martin Dráb 229,918 Most Valuable Professional on at
    Function LedgerDimensionDefaultingEngine::constructForMainAccountId has been incorrectly called
    Then the empty parameter must be _accountingStructureId.
  • Sachin Mittal Profile Picture
    Sachin Mittal 490 on at
    Function LedgerDimensionDefaultingEngine::constructForMainAccountId has been incorrectly called
    i have debugged ,  mainaccountid exists still its throwing error on this function
  • Martin Dráb Profile Picture
    Martin Dráb 229,918 Most Valuable Professional on at
    Function LedgerDimensionDefaultingEngine::constructForMainAccountId has been incorrectly called
    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.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,113 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,918 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans