Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Call method while creating invoice in Sales Order

(0) ShareShare
ReportReport
Posted on by 770

Dear All,

I want to insert some data related to invoice while creation invoice in Sales Order form.

Which place is exact to call my method to insert in my method?

Required filed to insert are invoice id, invoice date, Voucher & invoice amount, sales id, cust accout.

Thanks in advance.

*This post is locked for comments

  • Verified answer
    MUHAMMAD HAARIS Profile Picture
    770 on at
    RE: Call method while creating invoice in Sales Order

    code in SalesFormLetter class's main() method

    there is code like "if (salesFormLetter.prompt())
    {
    salesFormLetter.run(); ......

    after that if condition can insert data
    don't forget to check "parmEnum == DocumentStatus::Invoice" condition

    can get CustInvoiceJour table from "CustInvoiceJour = outputContract.parmJournal();"

  • Suggested answer
    Deepak Agarwal Profile Picture
    8,575 on at
    RE: Call method while creating invoice in Sales Order

    You must try event handler on sales invoice table.

  • Community Member Profile Picture
    on at
    RE: Call method while creating invoice in Sales Order

    You can only debug the code when you remove the checkbox 'Execute business operations in CIL' in your user options.

    Also it's possible that the journal is created with a recordInsertList in which case the insert method is not called I believe.

  • MUHAMMAD HAARIS Profile Picture
    770 on at
    RE: Call method while creating invoice in Sales Order

    Ya... Debugger is working in Sales Order's invoice process. But My coding in insert(method) of CustInvoiceJour(Table) is not working. i.e I thing It may not reached mentioned method in Sales Order's invoice process.

  • Sohaib Cheema Profile Picture
    46,614 User Group Leader on at
    RE: Call method while creating invoice in Sales Order

    you need to make sure 2 points to make debugging usable

    1) generate incremental CIL

    2) Enable breakpoints and debugging globally on server configuration

  • MUHAMMAD HAARIS Profile Picture
    770 on at
    RE: Call method while creating invoice in Sales Order

    Thanks Mr. Sohaib.

    I already tried in insert(method) of CustInvoiceJour(Table). But its not affected my custom table and  the debugger also not yet reached insert(method) of CustInvoiceJour(Table);

  • Sohaib Cheema Profile Picture
    46,614 User Group Leader on at
    RE: Call method while creating invoice in Sales Order

    I can see difficulty you are getting while working with classes.

    you may choose another, relatively simple way.

    you can make use of insert(method) of CustInvoiceJour(Table); As all your required fields land in same table, so, as the record is inserted here i.e. by end of insert method or after super() write your code to insert data in your custom table by taking  it form origin(CustInvoiceJour)

  • MUHAMMAD HAARIS Profile Picture
    770 on at
    RE: Call method while creating invoice in Sales Order

    Ok Thanks Vinit.

    I  generated CIL. But Debugger not reached to SalesinvoiceJournalPost-> postJournalPost method.. I want to insert Sales invoice details in my new talbe when the invoice is created. So I need to add my  code at end of the Invoice process.

    SalesinvoiceJournalPost-> postJournalPost method -  Not working.

    is there any other idea?

    Thanks in Advance.

  • vinitgoyal2005 Profile Picture
    6,330 on at
    RE: Call method while creating invoice in Sales Order

    read this post : community.dynamics.com/.../ax-2012-cil-how-does-it-work

  • MUHAMMAD HAARIS Profile Picture
    770 on at
    RE: Call method while creating invoice in Sales Order

    Ax 2012, Why Generate CIL needed?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

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,095 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 232,866 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans