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

Notifications

Announcements

No record found.

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
    237,770 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
    237,770 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

Responsible AI policies

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

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 692 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 558 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 364 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans