The code below is what I am using for my invoices to be Posted
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"
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.
What could be wrong when that error pops up?
Edit1: As I've used breakpoint, I found out that in LedgerJournalCheckPost.validate() the ledgerJournalTable.JournalNum is empty "".
LedgerJournalTablerecord? Also could you debug if fieldJournalNumhas a value at some point and if so, when this value gets lost before the call tovalidate()? - FH-Inway