0

I'm trying to release an especific invoice from Invoices and Memos screen (AR301000) using the SOAP API as documented in the I210 Contract Based Web Services guide.

Debugging my code, When I release the especific invoice I get this error:

System.ServiceModel.FaultException: 'PX.Data.PXInvalidOperationException: Operation failed ---> System.Data.SqlClient.SqlException: The multi-part identifier "LocationExtAddress.LocationBAccountID" could not be bound.
The multi-part identifier "LocationExtAddress.LocationCD" could not be bound.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)... and more error code

This is my code:

//successful login

//Invoice data
string invoiceType = "Invoice";
string invoiceNbr = "SS-00000009";

//Find the invoice to be released
ARInvoice invoiceToFind = new ARInvoice
{
    Type = new StringSearch { Value = invoiceType },
    ReferenceNbr = new StringSearch { Value = invoiceNbr },
    Hold = new BooleanValue { Value = false }
};
ARInvoice invoice = (ARInvoice) client.Get(invoiceToFind);

//Release invoice
InvokeResult invokeResult = client.Invoke(invoice, new Release());

//Monitor the status of the process
ProcessResult processResult = LongRunProcessor.GetProcessResult(client, invokeResult);

//Get the confirmed shipment
invoice = (ARInvoice)client.Get(new ARInvoice { ID = processResult.EntityId });

//Display the summary of the invoice
txtType.Text = invoice.Type.Value;
txtNumber.Text = invoice.ReferenceNbr.Value;
txtStatus.Text = invoice.Status.Value;

client.Logout();

The error occurs at the Invoke line.

1 Answers1

0

The first thing you need to make sure that your invoice is not on hold - if it is on hold then the entity returned by the Get will be empty. That could be a problem.

Also, can you please try using ReleaseInvoice() instead of Release() in the invoke?

InvokeResult invokeResult = client.Invoke(invoice, new ReleaseInvoice());

That has worked for me in the past.

Diane Cawley
  • 120
  • 5