Skip to main content

Notifications

Announcements

No record found.

X++ to code post general journal posting in D365FO

Hi,

In this post we will view the code to post general journal. For demo purpose, chosen already created journal entry that has no errors.

Step 1: Picked the journal that is not posted

8737.JournalEntry.jpg

Step 2: Click on lines and choose option "Simulate Posting" under Validate button.

6175.SimulatePosting.jpg

Step 3: Verified that there are no error/warnings.

1256.OperationCompleted.jpg

Step 4: Created a runnable class by name CG_GeneralJournalPosting to post this journal.

2055.Code.jpg

class CG_GeneralJournalPosting
{
/// <summary>
/// Runs the class with the specified arguments.
/// </summary>
/// <param name = "_args">The specified arguments.</param>
public static void main(Args _args)
{
LedgerJournalCheckPost journalCheckPost;
LedgerJournalTable ledgerJournalTable;

ledgerJournalTable = LedgerJournalTable::find("00636");

journalCheckPost = LedgerJournalCheckPost::newLedgerJournalTable(ledgerJournalTable, NoYes::Yes);
journalCheckPost.runOperation();
}

}

Step 5: Executed the runnable class to post the journal.

Result.jpg

Regards,

Chaitanya Golla

Comments

*This post is locked for comments