Can anyone help me make sense of this error? I’m not very experienced with writing custom command codes.
Server Side Exception BPM runtime caught an unexpected exception of 'InvalidOperationException' 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 'InvalidOperationException' type. See more info in the Inner Exception section of Exception Details. Program: System.Core.dll Method: First Original Exception Type: InvalidOperationException Framework Method: A001_CustomCodeAction Framework Line Number: 0 Framework Column Number: 0 Framework Source: A001_CustomCodeAction at offset 258 in file:line:column <filename unknown>:0:0 Server Trace Stack: at System.Linq.Enumerable.First[TSource](IEnumerable`1 source) at Epicor.Customization.Bpm.BOF448B9936A434E48A852612E9C92CC21.PreUpdatePreProcessingDirective_test02_with_error_5921C0441E4A4F80BB643D9C16C675AB.A001_CustomCodeAction() at Epicor.Customization.Bpm.BOF448B9936A434E48A852612E9C92CC21.PreUpdatePreProcessingDirective_test02_with_error_5921C0441E4A4F80BB643D9C16C675AB.ExecuteCore() at Epicor.Customization.Bpm.DirectiveBase`3.Execute(TParam parameters) in c:\_Releases\ICE\3.1.600.0\Source\Server\Internal\Lib\Epicor.Customization.Bpm\DirectiveBase.Generic.cs:line 129 Client Stack Trace ================== at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets) at Erp.Proxy.BO.TransOrderReceiptImpl.PreUpdate(TransOrderReceiptDataSet ds, Boolean& RequiresUserInput) at Erp.Adapters.TransOrderReceiptAdapter.PreUpdate(Boolean& requiresUserInput) Inner Exception =============== Sequence contains no elements
I’m trying to put a BPM that executes when a user forgets to enter a date in the Transfer Order Receipt field and then Receives the lines. In which case, Epicor would automatically enter today’s current date despite what is listed in the Ship Date on the Transfer Order Receipt Summary which ends up creating many inventory issues for us.
if it helps, this is my custom code on the method directive ‘TransOrderReceipt.PreUpdate’:
var ttTrnOrder = (from ttTFShipHead_Row in ttTFShipHead select ttTFShipHead_Row).First();
{
int x = 0;foreach (var plantTranx in (from PlantTran_Row in Db.PlantTran
where (PlantTran_Row.Company == ttTrnOrder.Company &&
PlantTran_Row.PackNum == ttTrnOrder.PackNum)
select PlantTran_Row))if (plantTranx.RecTranDate =< ttTrnOrder.ShipDate) { x++; }
if (x = 0)
{
throw new Ice.BLException(“The receipt date of the part is less than the shipdate. Please navigate to Stock > Date and ensure you have the correct date entered.”);
}
}