UBAQ Not Updating Posted AP Invoice Fields

Hey there,

I have this updatable BAQ:

If I double click a row and try to update it (even if I don’t change anything), I get:

C:\Users\Joe\Desktop\2020-09-28 15_42_56-Window.png

Message: Severity: Exception, Table: APInvHed, Field: , RowID: 7e5e6f7b-8cc8-4ed2-b8c0-43000195b94c, Text: Only the Due Date, Payments Held, Payment Method, Letter of Credit, Invoice Comments and Recurring Invoice fields can be changed on a posted invoice.
Query returned 1 row(s).

The only fields I have marked as updatable are APInvHed_PMUID and APInvHed_PayHold, which should be in the above list.

I’ve seen references to this issue, but no details on the resolution.

Anyone?

Thanks,

Joe

So, I thought I’d just roll my own update, so I used the “Advanced BPM Update Only” and added this code in the update base processing:

Erp.Contracts.APInvoiceSvcContract apInvoice = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.APInvoiceSvcContract>(this.Db, true);

using(var txscope = IceDataContext.CreateDefaultTransactionScope())        //Start Transaction
{
  foreach(var ttResults_xRow in (from row in ttResults
  where row.RowMod == IceRow.ROWSTATE_UPDATED
  select row))
  {
    dsAPInv = new Erp.Tablesets.APInvoiceTableset();
    
    dsAPInv = apInvoice.GetByID(ttResults_xRow.APInvHed_VendorNum, ttResults_xRow.APInvHed_InvoiceNum);
    
    var apInvHed_xRow = (from row in dsAPInv.APInvHed
    where row.Company == Session.CompanyID && 
    row.VendorNum == ttResults_xRow.APInvHed_VendorNum &&
    row.InvoiceNum == ttResults_xRow.APInvHed_InvoiceNum
    select row).FirstOrDefault();
    
    if (apInvHed_xRow != null)
    {
      //apInvHed_xRow.PayHold = ttResults_xRow.APInvHed_PayHold;
      //apInvHed_xRow.PMUID = ttResults_xRow.APInvHed_PMUID;
      apInvHed_xRow.RowMod = IceRow.ROWSTATE_UPDATED;
    }
    apInvoice.Update(ref dsAPInv);
  }
    txscope.Complete();                            //Close Transaction
}

It’s running through the list okay and setting the right fields, but not updating.

If I comment out setting the RowMod to updated the query reports success, but doesn’t update.

When I set the RowMod to updated I get the following error message:

Server Side Exception

BPM runtime caught an unexpected exception of 'ArgumentNullException' type.
See more info in the Inner Exception section of Exception Details.

Exception caught in: Epicor.ServiceModel

Error Detail 
============
Correlation ID:  5e105394-f1af-4b03-81ff-e32eda60eddd
Description:  BPM runtime caught an unexpected exception of 'ArgumentNullException' type.
See more info in the Inner Exception section of Exception Details.
Program:  Epicor.ServiceModel.dll
Method:  Compare
Line Number:  265
Column Number:  33
Original Exception Type:  ArgumentNullException

Client Stack Trace 
==================
   at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
   at Ice.Proxy.BO.DynamicQueryImpl.Update(DynamicQueryDataSet queryDS, DataSet queryResultDataset)
   at Ice.Adapters.DynamicQueryAdapter.<>c__DisplayClass27_0.<Update>b__0(DataSet datasetToSend)
   at Ice.Adapters.DynamicQueryAdapter.ProcessUbaqMethod(String methodName, DataSet updatedDS, Func`2 methodExecutor, Boolean refreshQueryResultsDataset)
   at Ice.Adapters.DynamicQueryAdapter.Update(DynamicQueryDataSet queryDS, DataSet updatedDS, Boolean refreshQueryResultsDataset)
   at Ice.UI.App.BAQDesignerEntry.BAQTransaction.<CallUpdate>b__379_0(Int32& rowReturned)
   at Ice.UI.App.BAQDesignerEntry.Forms.BAQDiagramForm.ShowQueryResults(DataSet dsResults, getQueryResult getResults, ReportAdditionalInfo additionalInfo)
   at Ice.UI.App.BAQDesignerEntry.BAQTransaction.CallUpdate()

Inner Exception 
===============
Value cannot be null.
Parameter name: Value cannot be null.
Parameter name: toItem

Now, what did I do?

Thanks,

Joe

Directly update the database field instead of calling BO. It’s safer to update PMUID and Payhold fields.

Ah. I have one more thing to try first. :slight_smile:

Thanks, Arul.

Joe