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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

"Journal does not exist" LedgerJournalCheckPost Validate method posting invoice journal using x++

(0) ShareShare
ReportReport
Posted on by 272

The code below is my code in posting my invoice journal

ledgerJournalTable = header.ledgerJournalTable();        
if (ledgerJournalTable.RecId > 0)
{
    ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable, NoYes::Yes, NoYes::Yes);
    // Post only if there is succesful validation.
    if (ledgerJournalCheckPost.validate())
    {
        ledgerJournalCheckPost.run();
    }
    else
    {
        info("Error.");
    }
}

but there is always an error that says: "Journal does not exist" when it goes into the ledgerJournalCheckPost.validate(). All the values that I've placed on the fields are correct because when I tried to use the same values manually, it was posted.

As I've used breakpoint, I found out that in LedgerJournalCheckPost.validate() the ledgerJournalTable.JournalNum is empty "", so it goes to the checkFailed that shows that the journal does not exist. Here is the snippet:

if (! ledgerJournalTable.JournalNum)
{
    isValid = checkFailed(strFmt("@SYS21496", ledgerJournalTable.JournalNum));
}

Also, I've checked the method newLedgerJournalTable in my code in posting the invoice (as seen above) and it got all the data I am posting. But the validate() does not, where I really need the validate method.

What could be the problem? The error Journal does not exist is the only thing that prevents me from posting. 

*This post is locked for comments

I have the same question (0)
  • Miguel Zuniga Profile Picture
    272 on at
    RE: "Journal does not exist" LedgerJournalCheckPost Validate method posting invoice journal using x++

    Hi Sir Crispin. Yes the run() method has a validate inside of it, a colleague of mine told me that yesterday as he was checking my code.

  • Sheikh Sohail Profile Picture
    6,125 on at
    RE: "Journal does not exist" LedgerJournalCheckPost Validate method posting invoice journal using x++

    There is delegate which execute after validation of journal, you can subscribe this delegate and get the validation result,

     [SubscribesTo(classStr(LedgerJournalCheckPost), delegateStr(LedgerJournalCheckPost, runInternalPostValidateJournalDelegate))]

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#3
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans