Hello everyone. We’re hoping were missing something small. We created a UBAQ that grabs all employees that are clocked into a job. We stuck a BPM in the GetList list method right in the BAQ itself. All the BPM does is set LaborDtl.EndActivity to true (clocks the user out) and saves.
This thing works beautifully in Pilot, but not in Live. Both Pilot and Live are the same versions, are Epicor Cloud Hosted. Why would this thing work in Pilot but not in Live… as far as we can tell, everything is identical.
string company = Session.CompanyID;
var empBasic = ServiceRenderer.GetService<Erp.Contracts.EmpBasicSvcContract>(Db);
var labor = ServiceRenderer.GetService<Erp.Contracts.LaborSvcContract>(Db);
var laborHeds = Db.LaborHed.Where(lh => lh.Company == company
&& lh.ActiveTrans);
List<string> empIds = new List<string>();
foreach(var laborHed in laborHeds) {
Erp.Tablesets.LaborTableset laborTs = labor.GetByID(laborHed.LaborHedSeq);
int updates = 0;
foreach(var laborDtl in laborTs.LaborDtl.Where(ld => ld.ActiveTrans)) {
laborDtl.EndActivity = true;
laborDtl.RowMod = "U";
updates++;
}
if (updates > 0) {
labor.Update(ref laborTs);
}
empIds.Add(laborHed.EmployeeNum);
}
foreach(string empId in empIds) {
string e = empId;
empBasic.ClockOut(ref e);
}
After the code executes, it sends an email telling us who was clocked in (and thereby clocked out). In Pilot, no error, email sent, list on email was correct, employees actually clocked out. In Live, no error, email sent, list on email was correct, employees not clocked out.
Probably would have been more efficient to schedule a function, but this should work, especially considering it works great in Pilot.
Any insight would be great. Perhaps back to the drawing board…
Thanks everyone for your input and help! Isolation worked in this instance. Found out it was the scheduling of the UBAQ that was failing. UBAQ itself was fine. Kinda feel silly for posting this now, honestly. If anyone else hits a similar issue, make sure to run things manually first and then work on leaving it up to the scheduler