We have a BPM on CustShip.Update (Post - b/c that is where we could get this to work).
The purpose of this BPM is to populate UD Fields on the ShipHead Table with a Sum of the Pack Lines, Quantities, Total Weight, and Total Boxes so that we can easily pass this data to EDI mappings.
The logic is working correctly, but with this BPM enabled we consistently get the message:
“Row has been modified by another user”
This is typically triggered by the user when they click the ‘Shipped’ checkbox. They can refresh and then have to re-click the checkbox and save.
We are pretty sure it is this BPM b/c when it is disabled, we do not see the message.
The BPM consists of one block of C#:
int vPackNum = 0;
int vPackLine = 0;
decimal vTotalQuantity = 0;
int vTotalPackLines = 0;
decimal vTotalNetWeight = 0;
decimal vTotalBoxes = 0;
string body1 = "Your Message Here 1";
this.PublishInfoMessage(body1, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "FirstVar","SecondVar");
vPackNum = Convert.ToInt32(callContextBpmData.Number01);
vPackLine = Convert.ToInt32(callContextBpmData.Number02);
callContextBpmData.Number01 = Decimal.Zero;
callContextBpmData.Number02 = Decimal.Zero;
callContextBpmData.Number03 = Decimal.Zero;
callContextBpmData.Number04 = Decimal.Zero;
var ttShipHeadRow = (from row in ds.ShipHead
where row.Company == Session.CompanyID
select row).FirstOrDefault();
if (ttShipHeadRow != null)
{
vPackNum = ttShipHeadRow.PackNum;
}
string body2 = "Your Message Here 2";
this.PublishInfoMessage(body2, Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "FirstVar","SecondVar");
foreach(var ShipDtlDbRow in (from row in Db.ShipDtl
where row.Company == Session.CompanyID
&& row.PackNum == vPackNum
select row))
{
vTotalPackLines++;
vTotalQuantity += Convert.ToDecimal(ShipDtlDbRow["OurInventoryShipQty"]);
vTotalNetWeight += Convert.ToDecimal(ShipDtlDbRow["TotalNetWeight"]);
if (ShipDtlDbRow["Character01"] != "")
{
vTotalBoxes += Convert.ToDecimal(ShipDtlDbRow["Character01"]);
}
}
callContextBpmData.Number01 = vTotalPackLines;
callContextBpmData.Number02 = vTotalQuantity;
callContextBpmData.Number03 = vTotalNetWeight;
callContextBpmData.Number04 = vTotalBoxes;
var ShipHeadDbRow = (from row in Db.ShipHead
where row.Company == Session.CompanyID
&& row.PackNum == vPackNum
select row).FirstOrDefault();
if (ShipHeadDbRow != null)
{
ShipHeadDbRow["Number01"] = callContextBpmData.Number01;
ShipHeadDbRow["Number02"] = callContextBpmData.Number02;
ShipHeadDbRow["Number03"] = callContextBpmData.Number03;
ShipHeadDbRow["Number04"] = callContextBpmData.Number04;
}
Any help is much appreciated.