Hi
Can somebody give me a hand with a BPM please. Currently have the below code working well on Part.Update Pre Processing Method Directive. I’d like to extend it, to add in a new PartWhse and then setting this newly added PartWhse as the default PartWhse on PartPlant. Not sure whether this can be achieved using BO calls on the GUI in BPM, or whether it’s custom coding.
Many Thanks
Mark
// AutoAssign Unique ID
Ice.Tables.UDCodes UDCodes = null;
foreach (var MyPart in (from ThisPart in ttPart where
ThisPart.RowMod == IceRow.ROWSTATE_ADDED &&
string.Equals(ThisPart.PartNum, "ENG", StringComparison.CurrentCultureIgnoreCase) == true
select ThisPart))
{
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
foreach (var MyUDCodes in (from ThisUDCodes in Db.UDCodes.With(LockHint.UpdLock) where
ThisUDCodes.Company == Session.CompanyID &&
ThisUDCodes.CodeTypeID == "AUTONUMBER" &&
ThisUDCodes.CodeID == "ENGPART"
select ThisUDCodes))
{
int NextEngPartID;
int.TryParse(MyUDCodes.CodeDesc, out NextEngPartID);
MyPart.PartNum = "ENG" + NextEngPartID.ToString();
MyPart.ClassID = "ENG";
MyPart.ProdCode = "ENG";
MyPart.TaxCatID = "STD";
NextEngPartID += 1;
MyUDCodes.CodeDesc = NextEngPartID.ToString();
}
Db.Validate();
txScope.Complete();
}
}