Modification of Function Signature breaks BPM

I had a BPM in place that was working fine. I had to add another output variable (at the end of the list) to use in the BPM. When I did this, I deleted the function call in the BPM and inserted it anew setting up all of the links between the local variables and the function output. Now when run the BPM, I get the following:

image

Log Name:      Epicor App Server
Source:        IceAppServer
Date:          3/23/2021 10:54:40 AM
Event ID:      0
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Description:
Ice.Common.EpicorServerException: BPM runtime caught an unexpected exception of 'InvalidCastException' type.
See more info in the Inner Exception section of Exception Details. ---> System.InvalidCastException: Specified cast is not valid.
   at Epicor.Customization.Bpm.BO918F7B5C18F74BB7A75F5FF9BA442691.ReceiveMfgPartToInventoryPreProcessingDirective_CheckQuantities_68ADDA320B2449ADA978A6CDFA1C14EC.A002_InvokeEpicorFunctionAction()
   at Epicor.Customization.Bpm.BO918F7B5C18F74BB7A75F5FF9BA442691.ReceiveMfgPartToInventoryPreProcessingDirective_CheckQuantities_68ADDA320B2449ADA978A6CDFA1C14EC.ExecuteCore()
   at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.700.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\DirectiveBase.Generic.cs:line 146
   --- End of inner exception stack trace ---
   at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.700.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\DirectiveBase.Generic.cs:line 162
   at Epicor.Customization.Bpm.MethodCustomizationBase2`3.<>c__DisplayClass12_0.<RunDirectives>b__3(MethodDirectiveBase`3 dir) in C:\_Releases\ICE\ICE3.2.700.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\MethodCustomizationBase2.cs:line 144
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at Epicor.Customization.Bpm.MethodCustomizationBase2`3.RunDirectives(TParam parameters) in C:\_Releases\ICE\ICE3.2.700.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\MethodCustomizationBase2.cs:line 146
   at Epicor.Customization.Bpm.CustomizationBase2`3.Execute(TParam parameters) in C:\_Releases\ICE\ICE3.2.700.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\CustomizationBase2.cs:line 87
   at Epicor.Customization.Bpm.BO918F7B5C18F74BB7A75F5FF9BA442691.ReceiptsFromMfgSvcCustomization.ReceiveMfgPartToInventory(ReceiptsFromMfgTableset& ds, Decimal pdSerialNoQty, Boolean plNegQtyAction, String& pcMessage, String& pcPartTranPKs, String pcProcessID)
   at Erp.Services.BO.ReceiptsFromMfgSvcFacade.ReceiveMfgPartToInventory(ReceiptsFromMfgTableset& ds, Decimal pdSerialNoQty, Boolean plNegQtyAction, String& pcMessage, String& pcPartTranPKs, String pcProcessID) in C:\_releases\ERP\ERP10.2.700.0\Source\Server\Services\BO\ReceiptsFromMfg\ReceiptsFromMfgSvcFacade.cs:line 1132
   at SyncInvokeReceiveMfgPartToInventory(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at Epicor.Hosting.OperationBoundInvoker.InnerInvoke(Object instance, Func`2 func) in C:\_releases\ICE\ICE3.2.700.12\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 59
   at Epicor.Hosting.OperationBoundInvoker.Invoke(Object instance, Func`2 func) in C:\_releases\ICE\ICE3.2.700.12\Source\Framework\Epicor.System\Hosting\OperationBoundInvoker.cs:line 28

When I run the function through Swagger, I get the expected data output. When I look at the BPM “code” on the server the variables do all line up with the datatypes. I even created new variables using the “Create New Variable” in the parameters wizard on the BPM.

I’ve not had this happen before, so I’m at a loss as to what to look at next.

Can you remove the function entirely from the BPM, save it and close out the BPM program (MD or DD), then re-open the BPM and try re-adding it.

I run into “timing” issues while changing a BAQ used by a dashboard. You have to exit dashboard designer completely, and then relaunch it after making the changes to the BAQ.

I tried all that. I even removed it from the BPM, closed Epicor completely, logged back in and demoted the function and re-promoted it. I got out of Epicor again, went back into the BPM and added the function in again. Exact same result.

I ended up removing the parameter from the function signature and added the function back in and it all works. I will just have to code that parameter into my BPM separately from the function.

Or make a new function (with a different name) ??

That was my next thought. I just need to get this into testing. I’ll circle back to it.

It may be cached c can you recycle the appserver?

That’s something I hadn’t tried. I also wondered if I exported it from dev and imported into live if I would have the issue…

I recycled. Stopped/Started the Appserver. Still the same issue.

I copied the function with a new name and tried to use it. Same error.