Published at: 2026-09-17

Object import rules


Overview

Object import rules let you run custom APL code before data is formally imported. This enables data preprocessing (such as calculating summary fields) and pre-validation (such as business rule checks). Administrators can configure separate APL logic for “create import” and “update import” scenarios, and use tenant-level controls to manage whether workflows and approval flows are triggered during import.

Description

When importing data, you can run APL code before the import to perform preprocessing. For example:
  • Scenario 1: When importing orders, calculate the sum of all line-item amounts and assign the result to the “Total Amount” field on the order header.
  • Scenario 2: During import preprocessing, process data in batches (for example, 20 records per batch) so that a single record failure does not roll back the entire import.

Configuration

Path: Admin Console > Object Management > Custom Object Management > Import Settings
Screenshot: object import rules

Import data preprocessing

There are two preprocessing methods for import: pre-validation and preprocessing.
Screenshot: object import rules

Pre-validation

  • The pre-validation function is similar to the create/edit pre-validation function. It can display validation messages and block invalid data.
  • If the import fails or validation errors occur, error messages are populated in the Excel failure list.
  • The return type is validateResult.
Pre-validation APL code example:
// Assign a value to imported data
context.data.owner = ["1000"]
// Validation logic
ValidateResult validate = ValidateResult.builder()
.success(false)           // Whether validation passed
.errorMessage("Error message") // Error message on failure
.build()
return validate

Preprocessing

  • Preprocessing APL code runs before pre-validation APL code.
  • Complex import validation logic can be computed during preprocessing and stored in the cache.
  • When pre-validation APL code runs, it reads the computed results from the cache for validation.
Preprocessing APL code example:
def taskId = context.task.taskId as String
log.info(context.task.taskId)    // Get the import task ID
log.info(context.task.lastBatch) // Whether this is the last batch

// During preprocessing, data is processed in batches of 20, stored in context.dataList
List<Map> dataList = context.dataList as List
// Store data in cache for use by the pre-validation function
Cache cache = Fx.cache.defaultCache
dataList.each{ data ->
  def rowNo = data._RowNo as String
  def name = data.field_MG1ch__c as String
  def key = taskId + "_" + rowNo
  log.info(key)
  def value = "" + name
  cache.put(key, value, 30)
}

return ValidateResult.builder()
.success(false)  // Returning false aborts the import
.errorMessage("test")
.build()

Processing timing

There are two processing timings: create import and update import. Both support preprocessing and pre-validation APL.
These two timings correspond to the two import methods on the front end: adding new data and updating existing data.
When either import method is used on the front end, the corresponding APL code runs.
Screenshot: object import rules
Only one preprocessing APL and one pre-validation APL can be added per timing. Include all processing logic in a single APL script.
Screenshot: object import rules

Import mode control

Both processing timings support “Import Mode Control”, with different control scopes:
  • Create import: “Trigger Workflow and Pipeline” and “Trigger Approval Flow”
  • Update import: “Trigger Workflow”
The Admin Console setting is a tenant-level control. After it is configured, the corresponding front-end import options are locked to match this setting.
Screenshot: object import rules

Related topics

Submit Feedback