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 :
Supply chain | Supply Chain Management, Commerce
Unanswered

Creating charges for vendor invoice in code

(0) ShareShare
ReportReport
Posted on by 1,673

Hi everyone

If you create a new vendor invoice, you can add charges to it from the front end. I'm trying to do this in code.

My code looks like this:


MarkupTrans  markupTrans;

markupTrans.initValue(); // or initFromVendInvoiceInfoTable()

markupTrans.AllOtherFields = someValues;

markupTrans.insert();

When I do this, I can't see my new charge from the front end because although it exists, the front end looks for a markupTrans record created against the VendInvoiceInfoSUBTable instead.

When I create a new record from the front end it also inserts the record against VendInvoiceInfoSUBTable. The code that calls the charge form is this:

 

        void clicked()
       {
           VendInvoiceInfoSubTable vendInvoiceInfoSubTable;

           if (VendInvoiceInfoSubTable::count(vendInvoiceInfoTable.ParmId, vendInvoiceInfoTable.TableRefId) > 1)
           {
               // more than one PO on the Invoice, so edit the summary invoice
               element.editMarkupTrans(this.menufunction(), vendInvoiceInfoTable);
           }
           else
           {
               // only one PO on the Invoice, so edit it
               select firstonly vendInvoiceInfoSubTable
                       where vendInvoiceInfoSubTable.TableRefId == vendInvoiceInfoTable.TableRefId
                             && vendInvoiceInfoSubTable.ParmId == vendInvoiceInfoTable.ParmId;

               element.editMarkupTrans(buttonSubTableMiscCharges.menufunction(), vendInvoiceInfoSubTable);
           }
       }

 

So, why if creating a record from VendInvoiceInfoTable does the standard code convert it into a vendInvoiceInfoSUBTable record? Why doesn't it just use the VendInvoiceInfoTable record I'm on? How does this affect how I should be creating a new charge record against a vendor invoice in code? How should I be doing that? As far as I know, VendInvoiceInfoSubTable relates vendor invoices to Purchase orders, but I don't always have a purchase order.

Thanks

 

I have the same question (0)

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 Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Supply chain | Supply Chain Management, Commerce

#1
Laurens vd Tang Profile Picture

Laurens vd Tang 98 Super User 2026 Season 1

#2
Sagar Suman Profile Picture

Sagar Suman 72 Super User 2026 Season 1

#3
André Arnaud de Calavon Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans