Our company has 2 locations and each runs their own version of Epicor. We are currently both on 2024.2.100 and our servers on on the same version (I don’t know which because I just do the Epicor end). I have a function that works in one system but not the other. Everything is exactly the same inside the function setup.
The function errors at Db.SaveChanges in one system. If I remove that line it runs but doesn’t updates the fields.
Working Function:
string lastPart = null;
var resultsTable = baqResults.Tables["Results"];
foreach (System.Data.DataRow row in resultsTable.Rows)
{
var partNum = row["Part2_PartNum"].ToString().Trim(); // trim to prevent mismatch
var goNegDate = row["Calculated_GoNegMain"] as DateTime?;
var updatedDate = row["Calculated_UpdatedDate"] as DateTime?;
var part = Db.Part.FirstOrDefault(p => p.PartNum == partNum);
if (part != null)
{
part.GoNegDate_c = goNegDate;
part.GoNegUpdated_c = updatedDate;
updatedCount++;
lastPart = partNum;
}
}
Db.SaveChanges();
// Push results into function outputs
UpdatedCout = updatedCount;
LastPartNum = lastPart ?? "None updated";
Error when adding Db.SaveChanges();
System.Drawing.Bitmap CS1061 'ILibraryContext' does not contain a definition for 'SaveChanges'
and no accessible extension method 'SaveChanges' accepting a first argument of type 'ILibraryContext' could be found
(are you missing a using directive or an assembly reference?)