Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

which method and class is best approach to add code during PO invoice in AX 2012?

Posted on by 5,901

hi all,

i have to add some logic in Purchase order  during Invoice as per business requirement..

As i know purchInvoiceJournalPost is called during PO invoice. i have debugged the PO invoice but not understand where we can add the code during invoice?

Kindly let me know which method and class is best approach to add code during PO invoice ?

Please give me more shed on this 

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    hi Osman,

    can you please let me know in which class and method, it is checking the item no from PurchLine and item model group of the item. during posting the PO.

    please give me more shed on this.

  • OsmanIstanbul Profile Picture
    OsmanIstanbul 2,803 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    Hi @rp@n,

    As Ergun mentioned there are lots of methods and Ergün listed some of them. But to verify which one is the right method, we must know more details. So I am not able to help you more.

    Best Regards.

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    Hi Osman,

    Just forgot about all the customization which I have required.

    Only tell me if I POST ANY PURCHASE ORDER THEN WHICH CLASS AND METHOD MAINLY CALLED DURING INVOICE.

    I AM LOOKING FOR EXACT METHOD.

    Please give me more shed on this

  • OsmanIstanbul Profile Picture
    OsmanIstanbul 2,803 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    Hi @rp@n

    why do you add the charge code PurchCreateOrder form? how will you change posting account? there are lots of account and posting types on purchase invoice vouchers. can you clarify your question please? some screenshots will be great.

    Best Regards

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    Hi,

    Have you understand my requirements?

  • ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    There were many methods I would say if it was another field, but if you say I want to change the GL account, I think you should do it first. Why don't you change it on the PO.

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    Hi Ergun,

    I put the debugger in init method of "PostInvoiceJournalPost" class and do the post.

    then it's goes to

    FormLetterJournalPost > Post method.

    In the post method , it's called many methods form PostInvoiceJournalPost class like

    PostLine

    PostMarkupLine

    UpdateJournalLine

    UpdateSourceLine etc...

    Kindly guide me which method , we can put condition based on my above scenario?

    Please give me more shed on this

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    Hi Ergun,

    Is it PurchInvoiceJournalPost class - Post Line method ?

    4075.J1.jpg

    but I not found any code in PostLine method. and also this.journlizeDocument() .

    Where the method get implemented?

    Please give me more shed on this

  • @rp@n Profile Picture
    @rp@n 5,901 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    Thanks Ergun,

    The requirement is

    I have added a check box "Misc PO" and Charges code in PurchCreateOrder form.

    If user mark Yes in Misc PO then the PO should consider as Misc PO not normal PO.

    For example -  In the charges code master they setup GL account suppose 11405.

    If the PO is MISC PO then the PO invoice should hit the GL account 11405 based on charges code setup.

    And for the NORMAL PO, It should work like STANDARD PROCESS.

    Basically I need to put condition during PO INVOICE , it SHOULD CHECK

    if the PO is MISC. PO then it should hit GL account which is mapped with CHARGES CODE and if the PO is NORMAL PO then it should work like STND. PROCESS.

    Kindly let me know the correct place to write code. I mean the which class and method ?

    Please give me more shed on this

  • Suggested answer
    ergun sahin Profile Picture
    ergun sahin 8,812 Super User 2024 Season 1 on at
    RE: which method and class is best approach to add code during PO invoice in AX 2012?

    The code goes through many classes and methods. The place where you write the code depends on the job you want to do.

    For example, if you're going to send a custom field from purchline, look at the VendInvoiceInfoLine.initFromPurchLine () / VendDocumentLineType_Invoice method.

    sites.google.com/.../howtopasscustomfieldfrompolinetoinvoiceline

    community.dynamics.com/.../copy-custom-field-from-po-line-to-invoice-line

    If you're going to add a new process, you can focus on the PurchInvoiceJournalCreate or PurchInvoiceJournalPost (may be postVendCust)classes.

    docs.microsoft.com/.../using-the-refactored-formletter-framework-white-paper

    Right now I dont have ax so I didnt check method names. Tomorrow I will write agin after check

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans