BPM to collect field data and insert on Order

Hi there

I will be creating a new UD field on our Customer table ‘Spec_c’

When a Sales Order is entered and a line created- i want this Spec_c field from the customer record to be copied to the Order Line Pack Comments.

I have used BPM’s for basics before, but think a BPM could handle this - can anyone walk me through how to do this please?

Post Processing BO on

Erp → BO → SalesOrder → GetNewOrderDtl

int custNum = ds.OrderHed.FirstOrDefault().CustNum;

OrderDtlRow newOrderDtl = ds.OrderDtl.Where(x => x.OrderLine == 0 && x.RowMod == "A").FirstOrDefault();

string spec = Db.Customer.Where(x => x.CustNum == custNum).FirstOrDefault().Spec_c;

newOrderDtl.OrderComment = spec;
1 Like

thankyou- is their no way to do this without coding?

You can do this with widgets. I can’t guide you.

Thankyou Kevin

ive added in the code, but on creation of a new order dtl line i get a bpm error

Server Side Exception

BPM runtime caught an unexpected exception of ‘NullReferenceException’ type.
See more info in the Inner Exception section of Exception Details.

Exception caught in: Epicor.ServiceModel

Error Detail

Correlation ID: cb1fad86-3870-4dde-a98f-ee8ecccb8c2f
Description: BPM runtime caught an unexpected exception of ‘NullReferenceException’ type.
See more info in the Inner Exception section of Exception Details.
Program: Erp.BO.SalesOrder.GetNewOrderDtl.dll
Method: A001_CustomCodeAction
Original Exception Type: NullReferenceException
Server Trace Stack: at Epicor.Customization.Bpm.BO.GetNewOrderDtlPostProcessingDirective_test_5F34851085F74BEAA39032AE656596B6.A001_CustomCodeAction()
at Epicor.Customization.Bpm.BO.GetNewOrderDtlPostProcessingDirective_test_5F34851085F74BEAA39032AE656596B6.ExecuteCore(Int32 step)
at Epicor.Customization.Bpm.DirectiveBase2.Execute() in C:\_releases\ICE\ICE4.2.100.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\DirectiveBase.Generic.cs:line 330 at Epicor.Customization.Bpm.DirectiveBase2.Execute(TParam parameters) in C:_releases\ICE\ICE4.2.100.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\DirectiveBase.Generic.cs:line 222

Client Stack Trace

at Ice.Cloud.ProxyBase1.CallWithCommunicationFailureRetry(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, RestRpcValueSerializer serializer) at Ice.Cloud.ProxyBase1.CallWithMultistepBpmHandling(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Ice.Cloud.ProxyBase`1.Call(String methodName, ProxyValuesIn valuesIn, ProxyValuesOut valuesOut, Boolean useSparseCopy)
at Erp.Proxy.BO.SalesOrderImpl.GetNewOrderDtl(SalesOrderDataSet ds, Int32 orderNum)
at Erp.Adapters.SalesOrderAdapter.GetNewOrderDtl(Int32 orderNum)
at Erp.UI.App.SalesOrderEntry.Transaction.GetNewOrderDtl()

Inner Exception

Object reference not set to an instance of an object.

Yeah it was a quick one off without null checks. I’ll see if I can help later or maybe someone will come along with guidance on how to do it with widgets.

This basically the same as what @klincecum did in widgets. It does require the same type of C# statement, but in an expression, so you still need to know how to query for the data. I used a generic comment on customer since I don’t have your field. This is an intrans data directive and passed syntax,checking, but has not been tested.

E10CopySpec.bpm (20.6 KB)

2 Likes

Thankyou Greg - this works a treat and has given me a good grasp of how to do this now in other areas, thankyou for this much appreciated :slight_smile: