Connecting TempTables to Db.Tables

Hi all,
My boss and I are having an issue setting a Quotehed UD table to null. (I think) We were able to figure out that we need to set TT values first, then set those values to the actual database table because of the rowmod error. The problem being is that I dont know how to do that lol. Does anyone have a reference/advice/tips for doing that? Ive posted the initial code so you can get the gist of what we are trying to do at a high level, along with some errors.

Thank you for any and all help! If there is a better way to do this, please let me know.

So you want to set Date01 to null for every QuoteHed in the database?

There’s a few things wrong according to the errors.

  • Some of the syntax issues seem to be due to missing “Using” statements or missing dll references.
  • “set” might be vb instead of c#, it is not needed.
  • RowMod is on temp tables, not on the actual db
  • Use Equals instead of Compare
1 Like

Honestly, if all I was doing was nulling a field when adding a new record, I’d just use a widget. Otherwise, I’d just access the temp table. It’s rarely a good idea to access the db directly. The system itself should be handling that.

foreach (var row in ttQuoteHed)
{
  if (row.RowMod == "A")
  {
    row.Date01 = null;
  }
}
//DONE. Go get lunch now.
2 Likes

@jtownsend that sounds exactly where we started with this. However, Quote.DuplicateQuote method does not seem to update the new QuoteHed with the information we put into the tt table. It is either that or Epicor goes back and makes sure that the quote information is copied from the quote we are duplicating. Either way, changing the tt table didn’t have any effect on the new quote. The Date01 field was filled in no matter if we set it on the pre- or post-processing.

So, we needed to get to the Db.QuoteHed to write to our Date01 field. This would actually clear the date field on the new code. So we enabled the post-processing from the pre-processing, then put this code in the post:

‘’'foreach (var ttQuoteHed_Row in ttQuoteHed)
{
try
{
foreach (var ord in (from drow in Db.QuoteHed
where drow.Company == ttQuoteHed_Row.Company
&& drow.QuoteNum == ttQuoteHed_Row.QuoteNum
select drow ))
{
{

      ord.Date01 = null;
   
}

}
}
catch
{
this.PublishInfoMessage(“Could not set the Original Date to null properly. Please clear manually and notify IT”,Ice.Common.BusinessObjectMessageType.Information,Ice.Bpm.InfoMessageDisplayMode.Individual,"","");
}
}’’’

1 Like

I had a similar issue with Part duplication and custom fields. The solution I arrived at was a data directive that triggered only when the update was called by Erp.Part.DuplicatePart.

That particular solution was entirely widget-based too, and again, only touched ttTables.