We are trying to write up a BPM that will take information entered when creating a new Vendor and populate the UD05 table. Below is the code I am using to populate UD05:
/* Finds required ud code types */
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
foreach (var UDCodeTypeFound in (from row in Db.UDCodeType where row.Company == Session.CompanyID && (row.CodeTypeID == "SupCustApp" || row.CodeTypeID == "SupRegApp" ) select row))
{
/* Finds all ud codes related to the selected ud types */
foreach (var UDCodeFound in (from row in Db.UDCodes where row.Company == Session.CompanyID && row.CodeTypeID == UDCodeTypeFound.CodeTypeID && row.IsActive == true select row))
{
/* Update UD Record */
UD05 newRow = new UD05();
Db.UD05.Insert(newRow);
newRow.Company = Session.CompanyID;
newRow.Key1 = VendorNum_c;
newRow.Key2 = UDCodeTypeFound.CodeTypeID;
newRow.Key3 = UDCodeFound.CodeID;
newRow.CheckBox01 = false;
newRow.ShortChar01 = UDCodeFound.CodeID;
}
}
Db.Validate();
txScope.Complete();
}
The method directive selected is Vendor > Update method and has a condition statement in place to catch whether the line updated is an added line or an updated one. I have troubleshot down through using message boxes and the BPM appears to follow the correct logic down to the C# code where we get the following error:
Based on that error I went to look at line 33 only to realize that there are only 31 lines of code. Then I thought to look at line 17 based on column 17 listed but couldn’t find any error on that line either. Does anyone have a method as to decypher what this error is actually looking at, and why it seems to be so angry?
I also tested to make sure that removing the c# code would allow the system to flow as intended, which it does. So the error is defiantly within the custom code. I have used this chunk of code in the past to write things to other ud tables but it works fine in those instances.