Hey,
I’m after some help with Exceptions and table inserts in a data-directive.
My data-directive runs In-Transaction and my flow is: conditions → custom code → raise exception.
The raise exception however prevents the row insert into my UD table presumably because it terminates on error. So my question is, how can I handle this where I need to prevent a row being created on the PODetail table (handled by the raise exception) and information being entered into a UD table (custom code).
The other strange thing is my custom code runs for emailing information out for example even with the raise exception - just not for the row insert on UD106.
Custom Code:
using (var txScope = IceContext.CreateDefaultTransactionScope())
{
foreach (var recPODet in (from row in ttPODetail
select row))
{
/* Update UD Record */
UD106 newRow = new UD106();
Db.UD106.Insert(newRow);
newRow.Company = Session.CompanyID;
newRow.Key1 = recPODet.PONUM.ToString();
newRow.Key2 = recPODet.POLine.ToString();
newRow.Key3 = Guid.NewGuid().ToString();
newRow.ShortChar01 = personname;
}
Db.Validate();
txScope.Complete();
}
Thanks!