preloader-matrix

Alfasith

X++ code to validate & post invent Journal in AX 2012

Hi,

static void AlfasithPostJournal(Args _args)
{ 
    InventJournalCheckPost      inventJournalCheckPost;
    InventJournalTable          inventJournalTable;
    ; 
    inventJournalTable = InventJournalTable::find("INV-0001245");
    inventJournalCheckPost = InventJournalCheckPost::newJournalCheckPost
(JournalCheckPostType::Check, inventJournalTable);
    inventJournalCheckPost.parmThrowCheckFailed(true);
 // This true enable to prompt the error msg validate the journal
    try
    { 
        inventJournalCheckPost.run();
    }
    catch
    {
        info("The journal contains errors.");
    }
}
*************************************OR*************************************
static void AlfasithPostJournal(Args _args)
{ 
    InventJournalCheckPost      inventJournalCheckPost;
    InventJournalTable          journalTable;
    ; 
    journalTable= InventJournalTable::find("INV-0001245");

if(InventJournalCheckPost::newPostJournal(journalTable).validate())
InventJournalCheckPost::newPostJournal(journalTable).run();
   

}

Regards,
Share on email
Share on facebook
Share on twitter
Share on linkedin
Share on pinterest

Leave a Reply

Your email address will not be published.