DEVELOPER TIPS TUTORIAL

Replacing Client Customizations with Epicor Functions

A technical deep-dive into refactoring client-side C# customizations into server-side Epicor Functions (EFx) for Kinetic Web UI compliance.

Overview

Epicor Kinetic's browser-native interface introduces major architectural advantages but completely sunsets the ability to run client-side C# customizations. Legacy WinForms code that directly queries databases or loads business object adapters will not run in the web client. The modern, supported method to handle complex data operations is to refactor these customizations into server-side **Epicor Functions (EFx)**, which can be invoked seamlessly from Application Studio using low-code actions.

Refactoring your custom logic into server-side Epicor Functions solves several performance issues. Rather than sending multiple data queries over the network, the client makes a single HTTP call to the EFx endpoint. The application server handles all data validation and table updates, reducing network latency and preventing database contention. For a detailed guide on creating and exporting reusable function libraries, check out our tutorial on Epicor Functions (EFx) Implementation.

Technical Implementation Details

To implement this solution in your Epicor environment, utilize the following code block. Ensure you replace the standard configurations with your company database names, server URLs, and keys.

// Server-Side Epicor Function (EFx) designed to run on the server and return data.
// This replaces client-side DynamicQueryAdapter WinForms calls:
// string baqName = "GetPartBinQty";
// dqa.RunQuery(baqName, executionParameters);
//
// Inside the EFx Function (C# code block):
this.CallService<Erp.Contracts.DynamicQuerySvcContract>(dynamicQuery => {
    var executionParams = new Ice.BO.QueryExecutionDataSet();
    var paramRow = executionParams.ExecutionParameter.NewRow();
    paramRow["ParameterName"] = "PartNum";
    paramRow["ParameterValue"] = partNum;
    paramRow["ValueType"] = "nvarchar";
    paramRow["IsEmpty"] = false;
    executionParams.ExecutionParameter.Rows.Add(paramRow);
    
    var queryResults = dynamicQuery.GetList("GetPartBinQty", executionParams, 0, 0, out bool hasMore);
    outQty = (decimal)queryResults.Tables["Results"].Rows[0]["Calculated_OnHandQty"];
});

Process Verification and Flow

Transitioning to an EFx-driven model also future-proofs your ERP customizations. Because functions expose standard endpoints, you can call them from external MES terminals, mobile apps, or web-based portals via Epicor's REST API. Read our developer tips in the Epicor REST API Integration Guide to learn how to secure your endpoints and integrate external databases with your ERP.

Looking for Professional ERP Customization Support?

Learn more about our Epicor REST API Integration Services or contact Amit directly to outline your optimization goals.

Request Free Epicor Architecture Audit