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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Data inconsistency in General Journal through x++.

(0) ShareShare
ReportReport
Posted on by 3,026

Hi all,

Trying to create & post general journal through x++ code.

I've successfully created & posted. But I found data inconsistency  in the table

"GeneralJournalEntry". field "JournalCategory" not have any value, which is mandatory in the table.

This is happening only when journal created, posted through x++ code.

Please find the script, & screen shots.

//Header

journalTable = new AxLedgerJournalTable();
journalTable.parmJournalName("ME");
journalTable.save();

select firstOnly ledgerJournalTrans_source //testing purpose selected posted transaction
where ledgerJournalTrans_source.RecId == 5637147721;

// createJournalLine(true);
journalTrans = new AxLedgerJournalTrans();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode(companyCurrency);
journalTrans.parmVoucher("ME-8111");
journalTrans.parmAmountCurDebit(422);
journalTrans.parmAccountType(ledgerJournalACType::Ledger);
journalTrans.parmLedgerDimension(ledgerJournalTrans_source.OffsetLedgerDimension);
journalTrans.save();

journalTrans = new AxLedgerJournalTrans();
journalTrans.parmJournalNum(journalTable.ledgerJournalTable().JournalNum);
journalTrans.parmTransDate(systemDateGet());
journalTrans.parmCurrencyCode(companyCurrency);
journalTrans.parmVoucher("ME-8111");
journalTrans.parmAmountCurCredit(422);
journalTrans.parmAccountType(ledgerJournalACType::Cust);
journalTrans.parmLedgerDimension(ledgerJournalTrans_source.LedgerDimension);
journalTrans.save();

ledgerJournalCheckPost = ledgerJournalCheckPost::newLedgerJournalTable(journalTable.ledgerJournalTable(), NoYes::Yes);
ledgerJournalCheckPost.run(); 

7331.Voucher.png GeneralJournalEntry_5F00_JournalCategory.png

Kindly suggest, changes required in the script?

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    240,335 Most Valuable Professional on at

    Just note that I've changed the category of this thread from AX (current version) to AX 2012. It's clearly not about AX 7.

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    Seems at header, you are not passing journalTable.parmJournalType(

  • krishna.rao@dax Profile Picture
    3,026 on at

    Hi Sohaib,

    It not seems the issue is with " journalTable.parmJournalType".

    Still having issue even  adding above line.

    Would be great, if someone please able to find the solution for this?

  • krishna.rao@dax Profile Picture
    3,026 on at

    Please someone could point the issue in the script or share any article/script which works well would be great help.

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    Hi Krishna,

    what is your journal type that you are creating?

  • Suggested answer
    jayh Profile Picture
    410 on at

    Set the Transaction type field on the Journal line:

    journalTrans.parmTransactionType(LedgerTransType::Cust);

  • krishna.rao@dax Profile Picture
    3,026 on at

    Journal type - Daily.

    As I said I've added line & done post, still the issue persists.

    I read some articles, haven't mentioned journal type in the script.

    Please let me know Is it the same issue someone facing.

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 2 on at

    Hi Krishna,

    Thank you for providing information.

    I will be getting back to in few hours may be at night after having testing.

  • krishna.rao@dax Profile Picture
    3,026 on at

    Appreciate your kind acknowledgement.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans