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)

How get information about who posted the General Journal

(1) ShareShare
ReportReport
Posted on by 1,036

Hello awesome community :)

I'm developing an SSRS report, I need to show the person who posted the journal in the report.

I searched in the "LedgerJournalTable" table but didn't find a "PostedBy" field.

if possible, how can I get the person who posted the journal?

Thanks in advance!

*This post is locked for comments

I have the same question (0)
  • Momochi Profile Picture
    1,036 on at

    I've done it with "modifiedBy" but I don't know how accurate it is.

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    I can see two ways to do this, with each way, having its own impacts.

    1)     Get this information from customization on LedgerJournalTable

    Add a new field in LedgerJournalTable named as PostedBy and make sure to update its value each time a journal is posted. The loss of using this way will be that you will not have information for new field for the journals that have been posted already.

    2)    Get this information from Posted GL voucher.

    Each journal when posted, creates vouchers in GL. This process throws many records in many tables. One of such table, is named as GeneralJournalEntry. By default this table has CraetedBy = Yes. This means you can make way to get information about who posted it.

    PS: Using Modified by is a not a best approach for GL journals because it is modified each time, you open a posted journal because of journal locking functionality.

  • Archie Profile Picture
    457 on at

    Hi Momochi,

    I have a similar requirement.. were you able to find a solution for this?

    Best

    Archana

  • Archie Profile Picture
    457 on at

    Hi Sohaib,

    I am planning to proceed with second way and I have found that there is no relation between these two tables,..can you suggest how to proceed in this case, sorry,  I am new to forms..I have put breakpoint on form LedgerJournalTab;e clicked method of post,post and transfer but getting lost...

  • Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    who said there are no relationships :)

    there are relationships among tables, to get details of posted journal. if you want me to code, you would need to wait, unless i get free some evening.

  • Archie Profile Picture
    457 on at

    Oh sorry, I might be missing something :( I think it would be unfair to ask you the code... appreciate if you can help me with any standard code examples..if any...but I can wait till evening:)

  • Momochi Profile Picture
    1,036 on at

    I've done it using the "LedgerJournalTable.modifiedBy"

    it's easier this way and it's working, but I don't know how limited it is.

    thanks!

  • Momochi Profile Picture
    1,036 on at

    Thanks Mr. Sohaib for your time and help.

    I've done it using "LedgerJournalTable.modifiedBy" but as I said, I don't know how limited this solution is.

    Right now it's working fine, but if there were any wrong data in the future, I would try your suggestions.

    Thanks again!

  • Archie Profile Picture
    457 on at

    Hi Sohaib,

    I have found a relation between LedgerJournalTable and GeneralJournalEntry via LedgerEntryJournal Table.

    Can you point me in the right direction pls..

  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Please fix the things, if you want any, before you deploy to Production. Such as labels etc. It is just a sample code(a job). You may convert this to use as display method or in any way you may want.

    static void Sample_Find_PostedBy_Opt2_BSC(Args _args)
    {
        LedgerJournalTable                      LedgerJournalTable,LedgerJournalTable4Search;
        LedgerJournalTrans                      LedgerJournalTrans;
        GeneralJournalEntry                     GeneralJournalEntry;
        GeneralJournalAccountEntry              GeneralJournalAccountEntry;
        LedgerEntryJournal                      LedgerEntryJournal;
    
        Dialog                                  objDialog;
        DialogField                             dfLedgerJournalId;
        LedgerJournalId                         gvLedgerJournalId;
        
        UserInfo                                UserInfo;          
        HcmWorker                               HcmWorker;
    
        void resetClearObjects()
        {
            LedgerJournalTable.clear();
            LedgerJournalTrans.clear();
            GeneralJournalEntry.clear();
            GeneralJournalAccountEntry.clear();
            LedgerEntryJournal.clear();
            UserInfo.clear();
            HcmWorker.clear();
        }
        ;
        resetClearObjects();
        objDialog           = new Dialog('Find Posted By');
        dfLedgerJournalId = objDialog.addField(extendedTypeStr(LedgerJournalId),'Please select a Journal Number');
        if(objDialog.run())
        {
            gvLedgerJournalId   = dfLedgerJournalId.value();
            LedgerJournalTable4Search  = LedgerJournalTable::find(gvLedgerJournalId);
            if(LedgerJournalTable4Search)
            {
                setPrefix(strFmt('Journal Id: %1 - Description: %2',LedgerJournalTable4Search.JournalNum,LedgerJournalTable4Search.Name));
                if(LedgerJournalTable4Search.Posted)
                {
                    Select firstonly createdBy,createdDateTime from GeneralJournalEntry                    
                        where GeneralJournalEntry.Ledger == Ledger::current()
                    join LedgerJournalTrans
                        where LedgerJournalTrans.TransDate == GeneralJournalEntry.AccountingDate
                            && LedgerJournalTrans.Voucher  == GeneralJournalEntry.SubledgerVoucher
                    join LedgerEntryJournal 
                        where LedgerEntryJournal.RecId == GeneralJournalEntry.LedgerEntryJournal
                            && LedgerEntryJournal.JournalNumber == LedgerJournalTrans.JournalNum
                    join LedgerJournalTable
                        where LedgerJournalTable.JournalNum == LedgerJournalTrans.JournalNum
                            && LedgerJournalTable.JournalNum == LedgerJournalTable4Search.JournalNum;
                    if(GeneralJournalEntry.createdBy || GeneralJournalEntry.createdDateTime)
                    { 
                        select firstOnly Name from UserInfo
                            where UserInfo.id == GeneralJournalEntry.createdBy;
                        HcmWorker = HcmWorker::find(DirPersonuser::findUserWorkerReference(GeneralJournalEntry.createdBy));
                        info(strFmt('Posted On : %1',GeneralJournalEntry.createdDateTime));
                        setPrefix('Posted By Details');
                        info(strFmt('UserId: %1',GeneralJournalEntry.createdBy));
                        if(UserInfo.name)
                        {
                            info(strFmt('UserName: %1',UserInfo.name));
                        }
                        if(HcmWorker)
                        {
                            info(strFmt('Personnel Number: %1',HcmWorker.PersonnelNumber));
                            info(strFmt('Personnel Name: %1',HcmWorker.name()));
                        }
                    }
                    else
                    {
                        info('Information not found or not available.');
                    }
                        
                }
                else
                {
                    warning('Yet journal is not posted, so information needed is not available. Please try posted journals only!');
                }
            }
            else
            {
                if(!gvLedgerJournalId)
                {
                    warning('No Journal selected!');
                }
                else
                {
                    warning('Invalid selection or unknown error!');
                }
            }
    
        }
        else
        {
            info('Operation cancelled');
        }
    
    
    
    }

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