Published at: 2025-10-30

Object Import Rules


Feature Description

When importing data, you can run APL code before the import to perform preparatory processing. For example:

  • Scenario 1: When importing orders, calculate the sum of amounts across all order lines and assign the total to the order header’s “Total Amount” field.
  • Scenario 2: During import preprocessing, you want the import to continue in batches (for example, batches of 20) so a single row error does not roll back the entire import.

Function Details

Operation path: [Admin Console] → [Object Management] → [Custom Object Management] → [Import Settings]

image

1. Import Data Preprocessing

There are two types of preprocessing for imports: pre-validation and preprocessing.

image

1.1 Pre-validation

  • The pre-validation function for imports works similarly to the pre-validation function used for Create/Edit operations. It can display validation messages and can block the operation.
  • If an imported row fails or a validation error occurs, the error message will be written back to the Excel failure list.
  • The return type must be ValidateResult.

Pre-validation APL code example:

// Assign values for import data context.data.owner = [“1000”] // Validation logic ValidateResult validate = ValidateResult.builder() .success(false) // Whether validation succeeds .errorMessage(“Error message”) // Error message when validation fails .build() return validate

1.2 Preprocessing

  • The import preprocessing APL runs before the pre-validation APL.
  • Complex validation logic can be computed during preprocessing and stored in cache.
  • When the pre-validation APL runs, it can read computed results from the cache for validation.

Preprocessing APL code example:

def taskId = context.task.taskId as String log.info(context.task.taskId) // Get import task id log.info(context.task.lastBatch) // Whether this is the last batch

// Import preprocessing executes in batches (20 rows per batch) with data in context.dataList List<Map> dataList = context.dataList as List // Cache information for use by 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 will stop this import .errorMessage(“test”) .build()

2. Timing of Processing

There are two import processing timings: Create Import and Update Import. Both timings support adding preprocessing and pre-validation APL.

image

These two timings correspond to the two frontend import methods: adding new records and updating existing records.

When users perform either import method on the frontend, the corresponding configured APL code runs.

image

You can add only one preprocessing APL and one pre-validation APL per processing timing. Implement the full processing logic within a single APL script.

image

3. Control Import Behavior (Renamed)

Both processing timings allow controlling import behavior; the available control options differ:

  • Create Import: control whether to trigger workflows and Pipeline, and whether to trigger approval flows.
  • Update Import: control whether to trigger workflows.

image

Settings made here in the Admin Console apply at the tenant level. When configured at the tenant level, the frontend import page will inherit these settings and disable the corresponding options.

image

Submit Feedback