Showing results for 
Search instead for 
Did you mean: 

Invalid document number [RCT2.DocEntry][line: 1]

0 Kudos

Hi experts,

I'm facing this problem when I create an incoming payment, I need to pay an invoice with a credit note, this is my code:

          var oPay = (Payments)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.oIncomingPayments);

            oPay.CardCode = cardCode;

            oPay.DocDate = DateTime.Today;

            oPay.CashSum = 0.01;

            oPay.DocType = BoRcptTypes.rCustomer;

            foreach (var d in notasCredito)


                oPay.Invoices.DocEntry = d.Key;

                oPay.Invoices.InvoiceType = BoRcptInvTypes.it_CredItnote;

                oPay.Invoices.SumApplied = (d.Value * -1);




               oPay.Invoices.DocEntry = oDoc.DocEntry;//I have a query to return the docentry of the invoice

               oPay.Invoices.InvoiceType = BoRcptInvTypes.it_Invoice;

               oPay.Invoices.SumApplied = totalAPagar;


               int re = oPay.Add();

I'd be glad if you can help me.

Best Regards.

0 Kudos

have you fixed this error? I encountered the sam problem

Accepted Solutions (0)

Answers (1)

Answers (1)

Active Contributor
0 Kudos

Hi Jonathan,

You do not need the oPay.Invoices.SetCUrrentLine(1);

Remark this line.



0 Kudos

Hi Edy,

The problem still persist without that line. Do you have another approach?

Best Regards.