Good afternoon,
To preface, I am very new to Kinetic and have taken the classes Epicor provided with consultants.
I am trying to find out what a contractor did on our system and I was able to find the code, I understand all of it, but if I wanted to replicate this functionality for another table, how would I find the equivalent of ERP.Contracts.VendorSvcContract for the Customer table? What is this string called? It would be easier to try to find it if I knew it’s proper name. I have put the code below with comments from Github copilot
Thanks!
// Update Vendor's NDA Fields
// Get the first record from ttXFileRef
var ttRow = ttXFileRef.FirstOrDefault();
// Query the XFileAttch table for a record where RelatedToFile is "Vendor", and Company and XFileRefNum match the values from ttRow
var XFileAttach = (from x in Db.XFileAttch
where x.RelatedToFile == "Vendor" &&
x.Company == ttRow.Company &&
x.XFileRefNum == ttRow.XFileRefNum
select x).FirstOrDefault();
// If a record is found, convert the Key1 field to an integer and assign it to vNum
if (XFileAttach != null)
{
vNum = Convert.ToInt32(XFileAttach.Key1.ToString());
}
// Get a service instance of VendorSvcContract
Erp.Contracts.VendorSvcContract vendAdp = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.VendorSvcContract>(Db);
// Retrieve a vendor record by the ID stored in vNum
Erp.Tablesets.VendorTableset vendds = vendAdp.GetByID(vNum);
// Depending on the DocTypeID of ttRow, update different fields in the vendor record
if (ttRow.DocTypeID == "NDA")
{
vendds.Vendor[0]["NDAAttached_c"] = true;
vendds.Vendor[0]["NDADate_c"] = DateTime.Now;
vendds.Vendor[0]["NDADue_c"] = DateTime.Now.AddYears(5);
}
else if (ttRow.DocTypeID == "CRT")
{
vendds.Vendor[0]["ISOCRTAttached_c"] = true;
vendds.Vendor[0]["ISODate_c"] = DateTime.Now;
}
else if (ttRow.DocTypeID == "EXR")
{
vendds.Vendor[0]["EXPAttached_c"] = true;
}
// Mark the vendor record as updated
vendds.Vendor[0].RowMod = "U";
// Send the updated vendor record back to the database
vendAdp.Update(ref vendds);
// Clean up by setting vendds and vendAdp to null and disposing of the vendAdp service instance
vendds = null;
vendAdp.Dispose();
vendAdp = null;