📄 Process Activities Tech Guide

Process Activities Tech Guide

1. Overview

Validates and processes XFarm field activity records into Epicor Jobs and Materials. For Epicor developers and operations engineers.It enables the structured conversion of verified field activity data to manufacturing jobs with correct materials and operat

ions and ensures data consistency between XFarm and Epicor production modules.

Technical overview:

  • Trigger: Manual execution from an EFx workflow or function

  • Preconditions: Activities must exist in UD107 with key Activity

  • Postconditions: Jobs, materials, and links updated or validated in Epicor

  • Running frequency: On demand

2. Key features

  • Validates XFarm activity records for completeness and correctness

  • Creates new Epicor Jobs linked to XFarm activities if required

  • Updates existing Jobs, materials, and operations

  • Applies tag mappings for activity identification

  • Controls status transitions for activity processing lifecycle

  • Supports filtering by date ranges, crop year, and error state

3. How it works

Step summary:

The function filters queued activities, validates each record's consistency, then updates Epicor Jobs, parts, bins, and materials accordingly.

Implementation details:

  • Retrieves activity records from UD107 with key Activity

  • Applies filters for CropYear, ActivityDateFrom, ActivityDateTo, LastUpdatedFrom, LastUpdatedTo, and error retry conditions

  • Validates fields including crop year, field IDs, commodity, variety, labels, and site mappings

  • Ensures Warehouse, Bin, and Part exist and are linked correctly

  • Validates Yield Units against UOM class in Epicor

  • Creates or updates Jobs via ThisLib.XFarmJob

  • Uses GetSetTags to tag Jobs for traceability

  • Processes material lines, ensuring no duplicates, and validates Product Containers

  • Handles status transitions for Processing, Error, or Completion

  • Uses transactions for safe record updates

Sample success JSON:

{
"status": "Success",
"activitiesProcessed": 5,
"errors": 0
}

Sample failure JSON:

{
"status": "Error",
"message": "Commodity ID 0 must be specified.",
"activityID": "1234"
}

4. Parameters & custom fields

Function inputs

Field

Purpose

sysTaskLinkID

Links execution to a background SysTask for logging

CropYear

Crop year filter for activities

ActivityDateFrom

Start date filter for activity dates

ActivityDateTo

End date filter for activity dates

LastUpdatedFrom

Start date filter for last updated timestamp

LastUpdatedTo

End date filter for last updated timestamp

RetryErrors

Include previously errored records in processing

ErrorsOnly

Process only records with previous errors

ProdCodeList

Optional product group filter for targeted processing

Literal status strings

Value

Purpose

Processing

Indicates activity is being processed

Error

Marks activity with processing error

5. Troubleshooting

Process is already running.
  • Cause: Duplicate SysTask detected

  • Fix: Wait for the existing task to complete

  • Check: Confirm via SysMonitor task list

Commodity ID must be specified.
  • Cause: Activity missing essential commodity data

  • Fix: Ensure XFarm activity includes valid commodity mapping

  • Check: Review UD107 record contents

Warehouse (XYZ) does not exist.
  • Cause: Invalid or missing warehouse code linkage

  • Fix: Verify field to warehouse mappings via COMXref

  • Check: Validate field and warehouse setup

UOM Class mismatch for Yield Unit (kg).
  • Cause: Unit of measure does not align with part configuration

  • Fix: Check UOM setup in User Codes (XFarmUOM)

  • Check: Review part master for UOM class

No Activity Details exist.
  • Cause: Missing child records for products or equipment

  • Fix: Verify UD107A records linked to activity

  • Check: Confirm complete activity data in Epicor

6. Security considerations

  • Uses dynamic SQL in GetRows clauses; risk mitigated by strict parameterisation

  • Reflection used to access host context; confined within internal Epicor scope

  • No direct external API calls; all operations within the Epicor service layer

  • String sanitisation applied to tags before storage

  • Weak error handling for unanticipated exceptions—relies on BLException for known validation issues

7. Additional notes

Prerequisites

Component

Requirement

Epicor Version

Supports EFx function architecture

Libraries

Ice.Contracts.SysMonitorTasksSvcContract, Ice.Contracts.UD107SvcContract

API Keys

Not applicable

Performance advice:

  • Processes all activities in-memory; large volumes may impact performance

  • Apply date or product group filters for optimised execution

Rollback/recovery notes:

  • Uses Epicor transaction scopes for safe data updates

  • Errors flagged in status; no automatic retry without RetryErrors enabled

Observability hooks:

  • Logs messages to SysMonitor Task log if sysTaskLinkID provided

  • Tag changes visibleare via SysTag service records