Cannot create LaborHed record via code

Hi there,

I’m trying to clock a user in via an external program in C# created using Epicor dlls.

I managed to Clock in a user using the following:
empBasicImpl.ClockIn(employeeNum, shiftNum)

Next I tried to create a new LabourHed record for the user so all transactions for that day get recorded against it. I used the following:

LaborImpl labor = WCFServiceSupport.CreateImpl<LaborImpl>(sessionObj, ImplBase<LaborSvcContract>.UriPath);
LaborDataSet laborDataSet = new LaborDataSet();

labor.GetNewLaborHed1(laborDataSet, employeeId, false, DateTime.Now.Date);
labor.Update(laborDataSet);

I thought that the above code should create a new head record, going off what Epicor showed me through a trace via Time and Expense Entry. Is there something I am missing?

Thanks!

When a user ClockIn, Epicor creates LaborHed record. There is no need to create it.

Hi,

This doesn’t seem to be the case whenever a user clocks in on our system. Is there any reason as to why this might happen?

It must create a LaborHed record with ActiveTrans = true for the current day unless there is an active record already available for that employee.That’s how Epicor tracks whether a user is logged in.

Thanks for that information. How is ActiveTrans set to true if I may ask?

We have found ActiveTrans to be false for a lot of our activities.

When a user Clockin, ActiveTrans is set to true. When ClockOut, ActiveTrans is set to false. Same principle applies for LaborDtl when a user Starts and Ends Direct or Indirect Activity.

I would’ve thought so, but when I clocked in, no LaborHed record was created therefore there is no ActiveTrans to be set to true.

Looking on the MES, I can see that I have been clocked in however.

I end up having to manually create the Head record in Time And Expense.

Instead of ClockIn using your code, try directly login to MES and check whether LaborHed record is created or not. I use EmpBasic.ClockIn BO/Method to clock in through Updatable BAQ and it works fine.

Any reason you’re not using REST? Every time Epicor updates the .DLLs, you’re going to have to recompile your external program and redistribute it. REST is the way that Epicor will be doing things in the future with Kinetic.

It’s just how we’ve always done it, ever since E9.

The plan is to eventually use REST going forward I believe and it is something we are looking into, just not currently!

@Arul I ended up figuring the issue out! I Had an if statement blocking the clock in code previously. The file I pushed out wasn’t up to date (doh!)

Soooo, pushing out of date files isn’t an issue with REST.

:wink:

Glad you got to the bottom of this. Have yourself a great day Sir!

1 Like