'Target Exception' on Enable Post-Processing BPM

Hi All,

I am currently trying to use a Pre-Processing BPM to Enable a Post-Processing BPM, but I am getting a ‘Target Exception’ when using this built-in method. Has anyone run into this issue before?

Thanks in advance for your help.

Can you give more detail?

Absolutely, but I do have to mention that I was able to make this work through the use of a data directive - I’m just curious as to why there is a ‘Target Exception’ thrown.

Here is the pre-processing BPM on Update method of SalesOrder.

I’m trying to set it up to call the following Post-Processing BPM:

This throws the following exception:

Server Side Exception

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

Exception caught in: Epicor.ServiceModel

Error Detail 
============
Description:  BPM runtime caught an unexpected exception of 'TargetException' type.
See more info in the Inner Exception section of Exception Details.
Program:  CommonLanguageRuntimeLibrary
Method:  CheckConsistency
Original Exception Type:  TargetException
Framework Method:  A001_CustomCodeAction
Framework Line Number:  0
Framework Column Number:  0
Framework Source:  A001_CustomCodeAction at offset 933 in file:line:column <filename unknown>:0:0

Server Trace Stack:     at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
   at System.Reflection.RuntimeMethodInfo.InvokeArgumentsCheck(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.RuntimePropertyInfo.GetValue(Object obj, Object[] index)
   at System.Data.Objects.ELinq.QueryParameterExpression.TryGetFieldOrPropertyValue(MemberExpression me, Object instance, Object& memberValue)
   at System.Data.Objects.ELinq.QueryParameterExpression.TryEvaluatePath(Expression expression, ConstantExpression& constantExpression)
   at System.Data.Objects.ELinq.QueryParameterExpression.EvaluateParameter(Object[] arguments)
   at System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption)
   at System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption)
   at System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator()
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source)
   at Epicor.Customization.Bpm.BO3CA669800EC144C89041F909D2AAA292.UpdatePostProcessingDirective_UpdateLines_6DFE4D7B828E4634A53BF2980C20B4E4.A001_CustomCodeAction()
   at Epicor.Customization.Bpm.BO3CA669800EC144C89041F909D2AAA292.UpdatePostProcessingDirective_UpdateLines_6DFE4D7B828E4634A53BF2980C20B4E4.ExecuteCore()
   at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in c:\_Releases\ICE\3.1.500\Current\Source\Server\Internal\Lib\Epicor.Customization.Bpm\DirectiveBase.Generic.cs:line 160



Client Stack Trace 
==================
   at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
   at Erp.Proxy.BO.SalesOrderImpl.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel, SalesOrderDataSet ds)
   at Erp.Adapters.SalesOrderAdapter.MasterUpdate(Boolean lCheckForOrderChangedMsg, Boolean lcheckForResponse, String cTableName, Int32 iCustNum, Int32 iOrderNum, Boolean lweLicensed, Boolean& lContinue, String& cResponseMsg, String& cCreditShipAction, String& cDisplayMsg, String& cCompliantMsg, String& cResponseMsgOrdRel)
   at Erp.UI.App.SalesOrderEntry.Transaction.Update()

Inner Exception 
===============
Non-static method requires a target.

It almost looks like there wasn’t valid code in your custom code block at the time of compiling the BPM. Is that a possibility?

That could be it. How do you recompile a BPM? I figured that occurred at each save?

Yes, I think it will compile when you save or when you check syntax. That’s probably what it was, since you said you were later able to get it working.