Hello. I am new to writing BPMs with C#. I am currently writing a data directive BPM using C# on ShipDtl table. What I am trying to accomplish is, for each row in ShipDtl table, get the ‘GrossWeight’ from the Part in that row and multiply that with ‘OurInventoryShipQty’ to get the TotalNetWeight for that row.
I get a FormatException when this BPM is triggered. I’m not sure what I am doing wrong. Can someone please point me in the right direction? Thanks !
Here is the code I am using.
var DetailRow = ttShipDtl[0];
String PartNumber = DetailRow[“PartNum”].ToString().Trim();
var GW = from p in Db.Part
where p.PartNum == PartNumber
select new {p.GrossWeight};
int GrossWeight = 0;
if(GW != null)
Convert.ToInt32(Decimal.Parse(GW.ToString()));
if(GrossWeight > 0)
{
if((GrossWeight * Convert.ToInt32(Decimal.Parse(DetailRow[“OurInventoryShipQty”].ToString())) < 1))
DetailRow.TotalNetWeight = 1;
else
DetailRow.TotalNetWeight = (GrossWeight * Convert.ToInt32(Decimal.Parse(DetailRow[“OurInventoryShipQty”].ToString())));
}
Also. here is the Client Stack Trace
at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet[] dataSets)
at Erp.Proxy.BO.CustShipImpl.UpdateMaster(CustShipDataSet ds, Boolean doValidateCreditHold, Boolean doCheckShipDtl, Boolean doLotValidation, Boolean doCheckOrderComplete, Boolean doPostUpdate, Boolean doCheckCompliance, Boolean ipShippedFlagChanged, Int32 ipPackNum, Int32 ipBTCustNum, String& opReleaseMessage, String& opCompleteMessage, String& opShippingMessage, String& opLotMessage, String& opInventoryMessage, String& opLockQtyMessage, String& opAllocationMessage, String& opPartListNeedsAttr, String& opLotListNeedsAttr, String& shipCreditMsg, Boolean& cError, Boolean& compError, String& msg, String& opPostUpdMessage, Boolean& updateComplete, Boolean& checkComplianceError, Boolean& changeStatusError, Boolean& checkShipDtlAgain)
at Erp.Adapters.CustShipAdapter.UpdateMaster(Boolean doValidateCreditHold, Boolean doCheckShipDtl, Boolean doLotValidation, Boolean doCheckOrderComplete, Boolean doPostUpdate, Boolean doCheckCompliance, Boolean ipShippedFlagChanged, Int32 ipPackNum, Int32 ipBTCustNum, String& opReleaseMessage, String& opCompleteMessage, String& opShippingMessage, String& opLotMessage, String& opInventoryMessage, String& opLockQtyMessage, String& opAllocationMessage, String& opPartListNeedsAttr, String& opLotListNeedsAttr, String& shipCreditMsg, Boolean& cError, Boolean& compError, String& msg, String& opPostUpdMessage, Boolean& updateComplete, Boolean& checkComplianceError, Boolean& changeStatusError, Boolean& checkShipDtlAgain)
at Erp.UI.App.CustShipEntry.Transaction.Update()