Consuming Pending Vendor invoice service from C#

This blog refers to consuming or creating Pending vendor invoice record in dynamics ax 2012 R3 using out of box service “VendVendInvoiceService”. The focus of this blog is .net C# side. In this example I took the complex case of creating Vendor invoice that linked to multiple PURCHASE ORDERS in received status.

This ADDHeader method insert record in VendInvoiceInfoTable, for this example I just filled the required ones.

header

This ADDLine method insert a line in VendInvoiceInfoLine table. this is helper method will be called from main executing point.

line

This is the main executing method, In this method I did initialization of required objects, make find call of two purchase order records using Purchase order service (You could do this by any way, hard coded or service call or through .net proxies). Here I am also making the call of AddHeader method to create the header record

methosstart

Further on the same method, call AddLine to create Line record, Also specify the QTY that how much I want to invoice from the receiving, I did the same for both the purchase orders.

beforetry

After composing complete message, making Create call to service

try

Thanks
Amir (Happy Daxing)

 

%d bloggers like this: