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)

Pre and Post event handler a Class

(0) ShareShare
ReportReport
Posted on by

hi all im new in ax365, 

i wanna custom description report on General Ledger>>Inquiries & Reports>>Ledger Reports>>Ledger Transaction List

3010.Screenshot_5F00_3.jpg

->just want to testing custom Description to "Test" by Create this class and using Post event handler, but didn't work

public static class LedgerTransListReportHelper_Extension
{
    [PostHandlerFor(classStr(LedgerTransListReportHelper), methodStr(LedgerTransListReportHelper, createReportData))]
    public static void LedgerTransListReportHelper_Post_createReportData(XppPrePostArgs args)
    {
        LedgerTransactionListStagingTmp     processingStagingTable;
        ;
        update_recordset processingStagingTable
            setting txt = "Test"
            where processingStagingTable.Txt != "";
    }

}

i did this custom report on ax2012 it works, description changed by add code in class LedgerTransListReportHelper, 

so i do the same in ax 365 but didn't know where i can put and the right code.

5076.Screenshot_5F00_4.jpg

so, i just only know by create post event handler & rebuild project/solution, i miss the step or wrong code ?

please give me solution,thanks.


Regards,

*This post is locked for comments

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

    Your code in AX 7 does a different thing than your code in AX 2012.

    You're not updating the buffer filled in with data in createReportData(); you create a new empty buffer in LedgerTransListReportHelper_Post_createReportData() and update this empty buffer, which has no effect at all.

    You must use the same temporary buffer. Unfortunately processingStagingTable is a local variable and therefore you can't access it from outside the method.

  • Martin Dráb Profile Picture
    237,892 Most Valuable Professional on at

    What you can do depends on how you need to fill the field. For example, you could use a handler for the Inserted event on LedgerTransactionListStagingTmp.

  • Community Member Profile Picture
    on at

    Hi,

    Use updating event handler in temporary tabmle to modify value of description and use the args passed in method parameters to acheive this

  • fajar Profile Picture
    3,805 on at

    Hi Agus,

    Can you solve this problem?

    I have same issue.

    Thanks.

  • Community Member Profile Picture
    on at

    thanks for the answer,

    already tried,  but didnt work.

    how exactly the code ?

  • Community Member Profile Picture
    on at

    thanks for the answer,

    still fail, please help.

  • Martin Dráb Profile Picture
    237,892 Most Valuable Professional on at

    I'm sorry, but "didnt work" isn't a problem description we can work with. If you want others to help you, you'll have to explain them what you need.

    I also said that what you can do depends on how you need to fill the field. Unfortunately you've address that.

  • Community Member Profile Picture
    on at

    sorry for my unclear,

    ya, i was create handler for the Inserted/inserting and try updating/updated event on LedgerTransactionListStagingTmp to make value description changed to "Test", but description didnt change at all, i still dont know how exactly code and where i can put the code to make description value change.

    the goal just for makes description change, and i thought with event handler or class extension to achieve it.

  • Martin Dráb Profile Picture
    237,892 Most Valuable Professional on at

    Can you please show your code and share what you've found when you debugged it?

  • Verified answer
    Community Member Profile Picture
    on at

    problem solved, now description can be updated, using coc recently i learned

    [ExtensionOf(ClassStr(LedgerTransListReportHelper))]

    final class LedgerTransListReportHelper_Extension

    {

       public void createReportData(LedgerTransactionListTmp _reportTmpTable,

                                   Query _query,

                                   TransDate _fromDate,

                                   TransDate _toDate,

                                   Reversed _includeReversed,

                                   TaxSpecification _includeTaxTransactions,

                                   boolean _sortByAccount,

                                   boolean _includeIntercompanyTaxes,

                                   boolean _summaryOnly)

       {

           VendTrans               vendTrans;

           VendInvoiceInfoTable    vendInvoiceInfoTable;

           VendPackingSlipTrans    vendPackingSlipTrans;

           VendPackingSlipVersion  vendPackingSlipVersion;

           VendPackingSlipJour     vendPackingSlipJour;

           GeneralJournalEntry     generalJournalEntry;

           GeneralJournalAccountEntry  generalJournalAccountEntry;

           Subledgerjournalentry   subledgerjournalentry;

           subledgerjournalaccountentry    subledgerjournalaccountentry;

           next createReportData( _reportTmpTable,

                                   _query,

                                   _fromDate,

                                   _toDate,

                                   _includeReversed,

                                   _includeTaxTransactions,

                                   _sortByAccount,

                                   false,

                                   false);

           update_recordSet _reportTmpTable

               setting Txt = vendInvoiceInfoTable.Description

               where _reportTmpTable.Txt == 'Summarized Vendor invoice journal'

                   join generalJournalEntry

                   where generalJournalEntry.JournalNumber == _reportTmpTable.JournalNumber

                       join subledgerjournalentry

                       where subledgerjournalentry.TransferId == generalJournalEntry.TransferId

                           join vendTrans

                           where vendTrans.Voucher == subledgerjournalentry.Voucher

                               join vendInvoiceInfoTable

                               where vendInvoiceInfoTable.Num == vendTrans.Invoice

                                  && vendInvoiceInfoTable.OrderAccount == vendTrans.AccountNum;

           update_recordset _reportTmpTable

               setting Txt = vendPackingSlipTrans.name

               where _reportTmpTable.txt == 'Summarized Vendor product receipts'

                   join generalJournalEntry

                   where generalJournalEntry.JournalNumber == _reportTmpTable.JournalNumber

                       join subledgerjournalentry

                       where subledgerjournalentry.TransferId == generalJournalEntry.TransferId

                       join vendPackingSlipVersion

                       where vendPackingSlipVersion.ledgervoucher == subledgerjournalentry.voucher

                           join vendPackingSlipJour

                           where vendPackingSlipJour.recid == vendPackingSlipVersion.vendPackingSlipJour

                               join vendPackingSlipTrans

                               where vendPackingSlipTrans.vendPackingSlipJour == vendPackingSlipJour.recid;

       }

    }

    thanks for the answer :) , i will ask here in the future

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