How can I post invoice journals in x++?

Hi,

I am trying to post an invoice journal in (Accounts payable/Area page  in journals/Invoices/Invoice journal) and here is the code that I am using in a job

static void testInvoiceJournalPosting(Args _args)
{
    LedgerJournalCheckPost  jourCheckPost;
    LedgerJournalTable      jourTable;


    jourTable =  LedgerJournalTable::find('JR04161547');

    if (jourTable.RecId > 0)
    {
        jourCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(jourTable,
                                                                NoYes::Yes,
                                                                NoYes::Yes);
        // Post only if there is succesful validation.
        if (jourCheckPost.validate())
        {
            jourCheckPost.run();
        }
    }
}

But it is failing at the jourCheckPost.validate() line of code. It seems like the LedgerJournalCheckPost doesn't have a parm method that takes LedgerJournalTable to pass in. It only takes the journalid. Am I missing something to add in my code? 

Thanks,

Dave

Related
Recommended