I had a difficult time starting production activity via the REST API, hopefully I can save someone the same trouble with this brief overview of the general process I ended up with.
Notes
- Your HTTP client must pass the
callSettingsheader for most of the write (POST/PATCH) operations to succeed, refer to your instance’s Swagger docs to see how this is accomplished by checking the headers passed in the “Try it out”curlcommands. - Clocking in/out employees is outside the scope of this overview, but an active clock is required for the given employee in order to start/stop production activity.
- You’ll need your job number, activity type, and op codes: there are numerous ways to retrieve these, but that is outside the scope of this overview.
- Co-parts, scrap and other related metadata is outside the scope of this overview, but once you are up and running with the core process you will have a solid idea about how to accomplish this.
- Some endpoints return their dataset (
ds) wrapped in areturnObjorparameterskey, you will never pass thereturnObjorparameterskeys to another endpoint, the nesteddsis all you need in these cases. - You can check for problems at almost any stage by calling the
Erp.BO.LaborSvc/CheckWarningsendpoint with the dataset you intend to use in the next call. This can be especially useful if your implementation is surfacing Epicor’s errors directly.
Starting activity
1. Get employee activity
- Purpose: Get current activity data for the employee,
LaborHedSeqis primarily what we are after. - Endpoint:
Erp.BO.LaborSvc/GetActiveLaborDtl - Input:
employeeNum - Response: full dataset (wrapped in a
returnObjkey) of the employee’s activity, for now we only need theLaborHed.0.LaborHedSeq(I don’t know the circumstances where aLaborHedarray might contain more than one item, if ever, so if defaulting to the first item is naive please let me know).
2. Get labor detail
- Purpose: Retrieve the full labor header/detail payload for the retrieved
LaborHedSeq. - Endpoint:
Erp.BO.LaborSvc/GetByID - Input:
laborHedSeq(obtained from step 1) - Response: full
ds(dataset) payload representing the employee’s labor record.
3. Start the activity
- Purpose: Get the full “start activity” dataset. Requires a start-type (e.g., ‘P’ for Production and ‘I’ for Indirect) and the retrieved labor dataset.
- Endpoint:
Erp.BO.LaborSvc/StartActivity - Payload:
{
"LaborHedSeq": <laborHedSeq>,
"StartType": <typeCode>,
"ds": <employeeLaborDataset>
}
- Response:
dsrepresenting the activity we’re starting.
4. Set the job number
- Purpose: Assign the requested job number to the activity.
- Endpoint:
Erp.BO.LaborSvc/DefaultJobNum - Payload:
{
"jobNum": <jobNum>,
"ds": <activityDataset>
}
- Response: updated
dswith job details set.
5. Set the operation sequence
- Purpose: Select the operation sequence to start within the job.
- Endpoint:
Erp.BO.LaborSvc/DefaultOprSeq - Payload:
{
"oprSeq": <operationSequence>,
"ds": <jobNumberDataset>
}
- Response: updated
dswith operation sequence details set.
6. Update the labor detail
- Purpose: Persist the labor detail to finalize the activity start, time starts once this request succeeds.
- Endpoint:
Erp.BO.LaborSvc/Update - Input: the last dataset (from step 5),
{"ds": <finalDataset>} - Response: final updated dataset, the activity is considered started.
Stopping activity
1. Retrieve the stop activity dataset
Note: You’ll need to know the laborHedSeq and laborDtlSeq of the labor you’re trying to stop, there are lots of ways to get this, in the context of a specific employee just get their active labor (Erp.BO.LaborSvc/GetActiveLaborDtl) and pick the relevant detail.
- Purpose: Get the completed dataset we’ll then pass to the labor update endpoint to finalize the activity.
- Endpoint:
Erp.BO.LaborSvc/OnLoadEndActivity
Payload:
{
"iLaborHedSeq": <laborHedSeq>,
"iLaborDtlSeq": <laborDtlSeq>
}
- Response: The final dataset (wrapped in a
returnObjkey) to end the activity.
2. Update the labor detail
- Purpose: Persist the labor detail to finalize the activity end, time stops once this request succeeds.
- Endpoint:
Erp.BO.LaborSvc/Update
Input: thedsdataset from thereturnObjof the previous call, just don’t pass thereturnObj, you only need theds. - Response: final updated dataset, the activity is considered ended.