# Custom Code In BPMs For Exceptions/Warnings **Category:** [Epicor ERP 10](https://www.epiusers.help/c/e10/5) **Created:** 2017-02-09 17:44 UTC **Views:** 3535 **Replies:** 1 **URL:** https://www.epiusers.help/t/custom-code-in-bpms-for-exceptions-warnings/37226 --- ## Post #1 by @jgarcia Hello, I'm trying to change the following code from throwing an exception to a simple warning message that pops up for the user. What do I need to change? //Exception if billing amount > Order amount callContextBpmData.Number01 = 0; callContextBpmData.Number02 = 0; foreach (var mileStone in (from mRow in Db.ProjectMilestone where mRow.OrderNum == @OrderNumVar && mRow.OrderLine == @OrderLineVar select new{mRow.OrderNum, mRow.OrderLine, mRow.BillingAmount, mRow.ProjectID, mRow.MilestoneID })) { if (mileStone.ProjectID == @ProjectIDVar && mileStone.MilestoneID == @MilestoneIDVar) { callContextBpmData.Number03 = 0; } else { callContextBpmData.Number01 = callContextBpmData.Number01 + mileStone.BillingAmount ; } } callContextBpmData.Number01 = callContextBpmData.Number01 + @BillingAmountVar ; foreach (var ord in (from oRow in Db.OrderDtl where oRow.OrderNum == @OrderNumVar && oRow.OrderLine == @OrderLineVar select new{oRow.OrderNum, oRow.OrderLine, oRow.ExtPriceDtl })) { callContextBpmData.Number02 = callContextBpmData.Number02 + ord.ExtPriceDtl ; } if( callContextBpmData.Number01 > callContextBpmData.Number02) { throw new Ice.BLException("Billing amount cannot be greater than the ext price on the order line."); } Any help would be appreciated! Thanks! --- ## Post #2 by @xiaoting Try to change : throw new Ice.BLException("Billing amount cannot be greater than the ext price on the order line."); to: if( callContextBpmData.Number01 > callContextBpmData.Number02) { InfoMessage.Publish("Billing amount cannot be greater than the ext price on the order line.",Ice.Common.BusinessObjectMessageType.Warning,Ice.Bpm.InforMessageDisplayMode.Individual;) } Or: if( callContextBpmData.Number01 > callContextBpmData.Number02) { this.PublishInfoMessage("Billing amount cannot be greater than the ext price on the order line.",Ice.Common.BussinessObjectMessageType.Warning,Ice.Bpm.InfoMessageDisplayMode.Individual,"",""); } --- **Canonical:** https://www.epiusers.help/t/custom-code-in-bpms-for-exceptions-warnings/37226 **Original content:** https://www.epiusers.help/t/custom-code-in-bpms-for-exceptions-warnings/37226