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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Ax2012 - How to Get Next Journal Number from C# via Interop Proxy

(0) ShareShare
ReportReport
Posted on by

Can anyone explain how to access the next Journal Number via class JournalTableData's nextJournalId() method?
In X++, the call looks like this:
this.JournalNum = JournalTableData::newTable(this).nextJournalId();

Since nextJournalId is not static, I have to create a JournalTableData instance and call JournalTableData.newTable() method.

C#:

myJournalDTO.Number = JournalTableData.newTable(null).nextJournalId();

I'm not sure what to do for the required parameter to newTable of a JournalTableMap.  The above gives a run time exception: {"Buffer not specified for call of JournalStatic::construct"} System.Exception {Microsoft.Dynamics.AX.ManagedInterop.ErrorException}

 I tried to create a JournalTableMap next, but same exception.  Looking at X++, it seem the parameter, while a JournalTableMap also accepted "this" which is a LedgerJournal Table.  I am unable to Cast LedgerJournalTable proxy into JournalTableMap... So Confused...

Any help is appriciated.

Thanks,

Joe

*This post is locked for comments

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

    I'm not aware of any way how to do it in .NET. JournalTableMap proxy class is not related to LedgerJournalTable in any way.

    But you can easily convert LedgerJournalTable to JournalTableMap in X++ by simple assignment. You could simply write a method accepting LedgerJournalTable and returning JournalTableMap. But more useful would be to add another factory method to JournalTableData acception Common, use SysDictTable::isTableMapped() to validate the parameter and call JournalTableData::newTable().

  • Verified answer
    Community Member Profile Picture
    on at

    I did not need to mess around with the class and tablemap in .NET.  I justed ended up adding a method to LedgerJournalTable to get, assign, and return the next journal id (similar to how insert() does it.).

    public LedgerJournalId getNextJournalNum()
    {
        ;

        this.JournalNum = JournalTableData::newTable(this).nextJournalId();
        return this.JournalNum;
    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans