Error on Invoke Function widget, Fixed by invoking function in Custom Code

TLDR: I noticed something weird with a BPM, and I’m wondering if anyone has seen this before, or maybe if it is something I should submit as a bug. I was getting a BPM Exception using an Invoke Function widget, but no error using this.InvokeFunction() in a Custom Code widget.

Longer:

We have an internal audit department, and one of the things they didn’t like was that we have a few gaps in our AR Invoice Sequence (certain InvoiceNums are “skipped”) due to deleted (unposted) invoices.

The company is still relatively new to Epicor, and usually these are from a misc invoice being deleted before it was posted because an RMA or Cancellation invoice is more appropriate. Rather than implementing Legal Number, which would add more complexity than I want, I created a fairly simple BPM & Function to log any invoice deletions to a UD Table.

The BPM is on ARInvoice.DeleteMaster (pre-proc). It opens a DataForm to ask the user why they’re deleting an invoice. Then it takes some details from InvcHead and Invokes a Function that logs everything to a UD Table.

When I built this late last year, it worked perfectly. At some point recently (not sure exactly when), it starting throwing an error.

The function actually still executes, but DeleteMaster fails and the Invoice is not deleted.

I couldn’t find anywhere I actually used indexing, and the whole function is wrapped in try/catch.

I added some debug messages before the Invoke Function widget, but the error came up without throwing any of the debug messages. Since I didn’t know where to start debugging, I replaced the “Invoke Function” widget and invoked the function via a custom code block (code below). All the parameters are the same variables / expressions as I configured in the Invoke Function widget. I figured I might be able to get more detail on the error if I put try / catch around the actual function call.

When I did this, the error went away. It never got to the catch block. It worked exactly as expected. Why would an Invoke Function widget work differently than this.InvokeFunction()?

string lib = "DeletedARInvoiceLog";
string efx = "DeletedInvoiceLog";

try {
    var response = InvokeFunction( 
                      lib, efx, InvcNum, PackNum, InvcType, CreateDate, DateTime.Today,
                      callContextClient.CurrentUserId, LogMessage, CredMemo );

    ErrorMsg = (string)response[0];

} catch (Exception ex) {

    ErrorMsg = "Function call failed:\n\n" + ex.ToString();
}

Is it possible the signature of the function changed since you first created the widget? The widgets don’t update themselves have to delete and recreate. Just the first scenario that comes to mind.

1 Like

Just tried deleting the widget and creating a new widget with new configuration. Same result. Good thought, though. I originally double-checked that the configured params matched the function params, but didn’t delete or reconfigure. The one thing I tried changing was switching the “DeletingUser” param from Session.UserID to callContextClient.CurrentUserID, but that had no effect.

What if you dump sources, does that show what is different in the widget version?

Didn’t know that worked in cloud. Where does it save the files?

I don’t know either but somebody said they got it working last week.

1 Like

Response from Epicor:

2 Likes

“Cannot be provided”

BS, change one line in host.config to put them in the EpicorData directory.

It’s just laziness. Make it the default.

4 Likes

:fire:

Can neither confirm nor deny they are in the server temp dir accessible while system.io lasts

1 Like

VOTE!