Search code examples
acumatica

How to get error or success result from Acumatica Web service API?


//LoginResult loginResult = context.Login("user","pass");
//if (loginResult.Code != ErrorCode.OK)
//Get Schema
//Insert
//Add fields values
//....
O301000.Actions.CopyOrder,
O301000.Actions.Save,
O301000.OrderSummary.OrderNbr
Submitresult = O301000.context.Submit(cmds);

How do I know if there was an error when inserting/saving the Order (or any other file)?

I just can find a value 'Submitresult.ErrorCode' like in the Login Result.

Mean while a have solve the issue, when inserting, by looking for the 'O301000.OrderSummary.OrderNbr' not null value.

But that does not works when updating a record.


Solution

  • You should always use a try{Submitresult = O301000.context.Submit(cmds);} catch(Exception ex){Console.WriteLine(ex.Message);}

    when making these calls. If the SOAP calls returns an error, than the message is passed to the Exception object.