English
Groovy Code Examples
About 173 wordsLess than 1 minute
2026-01-09
Pre-import Validation APL Code - Function Template
// Validation logic
log.info(context.data)
def data = context.data as Map
// Get task ID and row number
def taskId = data._TaskId as String
def rowNo = data._RowNo as String
log.info(taskId)
log.info(rowNo)
// Retrieve pre-processing function data from cache
Cache cache = Fx.cache.defaultCache
def key = taskId + "_" + rowNo
def value = cache.get(key)
log.info(value)
return ValidateResult.builder()
.success(true)
.errorMessage("I'm the pre-import validation function!!!!")
.build()Import Pre-processing APL Code - Function Template
// Get import task ID and whether it's the final batch
def taskId = context.task.taskId as String
log.info(context.task.taskId)
log.info(context.task.lastBatch)
// Cache information for pre-validation function
Cache cache = Fx.cache.defaultCache
List`<Map>` dataList = context.dataList as List
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()
// Return false will terminate the import
.success(false)
.errorMessage("I'm the import pre-processing function!!!!")
.build()