Skip to main content

Notifications

Announcements

No record found.

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 2,953

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

  • krishna.rao@dax Profile Picture
    2,953 on at
    RE: Data inconsistency in General Journal through x++.

    Appreciate your kind acknowledgement.

  • Sohaib Cheema Profile Picture
    46,614 User Group Leader on at
    RE: Data inconsistency in General Journal through x++.

    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
    2,953 on at
    RE: Data inconsistency in General Journal through x++.

    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.

  • Suggested answer
    jayh Profile Picture
    410 on at
    RE: Data inconsistency in General Journal through x++.

    Set the Transaction type field on the Journal line:

    journalTrans.parmTransactionType(LedgerTransType::Cust);

  • Sohaib Cheema Profile Picture
    46,614 User Group Leader on at
    RE: Data inconsistency in General Journal through x++.

    Hi Krishna,

    what is your journal type that you are creating?

  • krishna.rao@dax Profile Picture
    2,953 on at
    RE: Data inconsistency in General Journal through x++.

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

  • krishna.rao@dax Profile Picture
    2,953 on at
    RE: Data inconsistency in General Journal through x++.

    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?

  • Sohaib Cheema Profile Picture
    46,614 User Group Leader on at
    RE: Data inconsistency in General Journal through x++.

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

  • Martin Dráb Profile Picture
    233,025 Most Valuable Professional on at
    RE: Data inconsistency in General Journal through x++.

    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.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 294,325 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,025 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans