Developer forum

Forum » Integration » BC CodeUnit - Error with OpenOrders and Invoices

BC CodeUnit - Error with OpenOrders and Invoices

Chris Søgaard
Chris Søgaard
Reply

Hi DW

We're using Integration Customer Center app in DW which connects to BC Code Unit 1.2.0.17. BC version is 18.

We have a problem when trying to get documents on orders and invoices on a sales person, that is no longer available in BC, e.g. when a sales persons leaves the company. 

I'm executing the GetList command <GetList type="Invoice" customerID="54885814"></GetList> and get a response with this item:

If I try to execute the GetItem command I get an expected response.

But if I try to get the document attached to this item with this command <GetPDFForItem type="Invoice" id="103649" externalUserID="54885814"/> I get this response from code unit:

BR Chris

 


Replies

 
Dmitriy Benyuk Dynamicweb Employee
Dmitriy Benyuk
Reply
This post has been marked as an answer

Hi Chris,
that is because the BC renders the report internally and indeed it is calling functions that are looking for the SalesPerson by its code, here is a stack:

So you can try to empty the field "Salesperson Code" in the Record "Sales Invoice Header", you can try to use the subscriber:
CustomerCenterPublisher.OnBeforeExecuteGetPdfForItemRequest(XMLdocIn, stopExecution, response);
and inside it check the type:
if XmlHelper.GetTextFromNode(XMLdocIn.AsXmlNode(), '/GetPDFForItem/@type') = 'Invoice'
get the "Sales Invoice Header" by id from here: XmlHelper.GetTextFromNode(XMLdocIn.AsXmlNode(), '/GetPDFForItem/@id')
and check if this invoice sales person is deleted and if yes then update your ivoice with empty "Salesperson Code".
XmlHelper is Codeunit DynamicwebXmlHelper.

By the way is it possible to download this pdf report(or other format for this kind of report) from BC without errors?

BR, Dmitrij

Votes for this answer: 1
 
Chris Søgaard
Chris Søgaard
Reply

Hi Dmitrij

Thank you for your thorough response once again.

I was under the impression that this could be done in BC without errors, but given your response here I will double-check with the client, that this is actually possible in BC.

We will take a look at this and get back if we need more from you.

BR Chris

 

You must be logged in to post in the forum