开发者

Inserting invoice transactions with Dynamics AX / Axapta Business Connector

G'day,

OK, I have now rewritten this question totally:

I am trying to import data into Dynamics through the use of the Business Connector (ideally, I would be importing it directly through SQL but I understand that is not a good idea - however I am open to other suggestions). This is to import invoices from a production system into Dynamics / Axapta (v5).

I can code to insert data into the CUSTINVOICETABLE table, which works fine and generates the RECID. However, new invoices just inserted exist without an Invoice ID (until they are posted I understand). However, I need to insert line items into the CUSTINVOICETRANS table as children of the above entry. For this you need to set the INVOICEID field to refer the above as the link to the parent. However, t开发者_如何学Chis does not appear possible before the invoice has been posted. Or I may be way off track?

Does anyone have any ideas or can shed any light for me? That would be much appreciated.

Regards, Steve


To post a "Free text invoice" simply call custPostInvoiceJob.run() method. You will have have to make the object first, then call a method with your newly created CustInvoiceTable record.

In X++:

custPostInvoiceJob = new CustPostInvoiceJob();
custPostInvoiceJob.updateQueryBuild(custInvoiceTable);
custPostInvoiceJob.run();

You will have to translate that into Business Connector calls in your preferred language.


Ok, it's actually as easy as it should be.

After the insert statement, simply use the get_Field call:

axRecord.Insert(); recID = (long)axRecord.get_Field("RECID");

You insert the line items in the CUSTINVOICELINE table (which uses a PARENTRECID), then upon posting the items get inserted into the CUSTINVOICETRANS table linked to the appropriate invoice number.

I hope this saves someone from having to work this out themselves.

Steve

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜