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)

 

Advertisements

2 Responses to Consuming Pending Vendor invoice service from C#

  1. Steve Craze says:

    Hi Amir, thanks for the post! One thing I am struggling with – I don’t have the property legInvoiceOptions in AxdEntity_VendInvoiceInfoTable object (I checked the whole WCF contract and nothing named like that). Is there something I am missing? Many thanks!

    • Amir Nazim says:

      sorry for the confusion, That’s the customized feature/project we have did to support invoice creation and posting and we are controlling this using customized legInvoiceOption field. Out of box service does not support posting of invoice.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: