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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Post PO Invoice Amount Zero

(0) ShareShare
ReportReport
Posted on by 282

Hi all,

I need to Post PO Invoice Line amount and Gross amount as Zero if my custom field is (in PurchTable) "Yes", so for which class or method i should do extension in 365.

Please reply if anyone have idea.

Thanks in advance,

Amol

I have the same question (0)
  • Suggested answer
    Sumit Loya Profile Picture
    2,230 on at

    Hi Amol,

    If for your custom field, the Purchase order amount should be 0, then I would suggest that you set the unit price on Purchase order line to 0 on creation or when the field is modified on Purchase order header. This way the invoice line amounts will also be 0. You can achieve this by extending PurchLineType class.

    If you still wish to set this only at invoice level, then  have a look at PurchFormLetterParmDataInvoice class and specifically method createParmLinesAndTable method. This is where the staging table and lines are created during invoicing process.

  • Suggested answer
    Ludwig Reinhard Profile Picture
    Microsoft Employee on at

    Hi Amol@,

    Why is it that you have to post the PO invoice line with a price of $0?

    Did you get the product for free?

  • Amol@ Profile Picture
    282 on at

    Hi Sumit,

    Thanks for reply,

    I have tried doing COC of createParmLinesAndTable method of PurchFormLetterParmDataInvoice  class, but not succeeded.

    Below my coc-

    protected void createParmLinesAndTable()

       {

           VendInvoiceInfoLine     vendInvoiceInfoLine;

           PurchTable                   purchTable;

           ParmId                         currentParmId = this.parmId();

           next createParmLinesAndTable();

           select vendInvoiceInfoLine where vendInvoiceInfoLine.ParmId == currentParmId;

           purchTable = PurchTable::find(vendInvoiceInfoLine.OrigPurchId);

           if(purchTable.CON == NoYes::Yes)

           {

               if(vendInvoiceInfoLine)

               {                

                   info(strFmt("Before = %1",vendInvoiceInfoLine.LineAmount));

                   vendInvoiceInfoLineUp.LineAmount = 0;

                   info(strFmt("After = %1",vendInvoiceInfoLine.LineAmount));                

               }

           }

       }

    In debugging it's triggering and getting value (Line Amount Value) in Before info and updating line amount 0 in after info but in table it is not updating zero.

    let me know if any suggestion,

    Thanks,

    Amol

  • Suggested answer
    Sumit Loya Profile Picture
    2,230 on at

    The update buffer, I see is vendInvoiceInfoLineUp but you are displaying info from vendInvoiceInfoLine also you are not calling update method. just by assigning the value is not enough.

  • Amol@ Profile Picture
    282 on at

    Hi Sumit,

    Typo mistake in buffer,

    Below is updated code ,

    protected void createParmLinesAndTable()

       {

           VendInvoiceInfoLine      vendInvoiceInfoLine,vendInvoiceInfoLineUpdate;

           PurchTable                   purchTable;

           ParmId                        currentParmId = this.parmId();

           next createParmLinesAndTable(); //Next

           select vendInvoiceInfoLine where vendInvoiceInfoLine.ParmId == currentParmId;

           purchTable = PurchTable::find(vendInvoiceInfoLine.OrigPurchId);

           if(purchTable.CON == NoYes::Yes)

           {

               info(strFmt("Update Before = %1",vendInvoiceInfoLine.LineAmount));

               update_recordset vendInvoiceInfoLineUpdate

                   setting LineAmount = 0

                   where vendInvoiceInfoLineUpdate.OrigPurchId == vendInvoiceInfoLine.OrigPurchId &&

                     vendInvoiceInfoLineUpdate.ParmId == currentParmId;

               info(strFmt("Update After = %1",vendInvoiceInfoLineUpdate.LineAmount));

           }

       }

    But it's giving below error-

    pastedimage1620648129136v1.png

    Kindly suggest,

    Thanks in Advance,

    Amol

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 681 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 598 Super User 2026 Season 1

#3
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 579

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans