---
title: "Transform maps"
site: admin
version: 2027.1
versions: "all"
url: https://docs-new.servicely.ai/admin/2027.1/data-import/transform-maps/
type: reference
application: platform
last_updated: 2026-12-03
commit: 6777698daac5
---


A transform map says how records in a staging table become records in a target table. Use this page while you build one under **Data import → Transform → Transform maps**. For how transform maps fit into an import, see [How data import works](page:data-import/how-data-import-works).

<Image src="asset:screenshots/admin/data-import-transform-maps/transform-map-form.png">The Create Import transform form, with the fields this page describes.</Image>

## Transform map fields

| Field | Description |
| --- | --- |
| **Name** | A name for the transform map. It is for information only. |
| **Description** | What the map is for. |
| **Source table** | The staging table the data comes from. |
| **Target table** | The table the records are created in or updated. |
| **Field mappings** | The mappings, one per target field. See the next section. |
| **Preprocess script** | Runs for each row before its mappings. It can skip the row. |
| **Postprocess script** | Runs for each row after it is written to the target. |
| **Next transform** | Another transform map to run after this one, as the next stage of a pipeline. |
| **Reset processed records to pending** | Sets successfully processed staging records back to pending, so the next transform stage processes them too. |
| **Suppress triggers** | Writes target records without running triggers, workflows and events. |
| **Suppress validation** | Writes target records without field validation. |
| **Suppress audit** | Writes target records without audit history. |
| **Preserve source system fields** | Keeps **CreatedOn**, **CreatedBy**, **UpdatedOn** and **UpdatedBy** from the source instead of stamping them. Use it for migrations. |

The **Generate mappings** operation creates a mapping for each staging field. **Delete mappings** removes them all.

## Field mapping fields

| Field | Description |
| --- | --- |
| **Name** | A name for the mapping. |
| **Type** | Copy, Lookup, Lookup Multiple or Transform. See the next section. |
| **Source field** | The staging field to read. Optional for the Transform type. |
| **Target field** | The field on the target table to set. Every type needs one. |
| **Primary key** | Marks the mapping as part of the key that matches a row to an existing target record. |
| **Lookup table** | For Lookup and Lookup Multiple, the table to search. |
| **Lookup field** | For Lookup and Lookup Multiple, the field on the lookup table to match the source value against. |
| **Create on missing** | For Lookup and Lookup Multiple, creates the related record when no match is found. |
| **Create lookup value script** | Optional script that runs before a missing related record is created. The new record is `current`, with the lookup field already set, so the script can set its other fields. If the script returns `false`, the record is not created. |
| **Script** | For Transform, the script that calculates the value. |

Every load needs at least one primary key mapping. The key must be unique in the target table. For users, use a username or email address, not a name. For contracts or migrated tickets, use their numbers. Several mappings can be primary keys together. Mark Copy mappings as primary keys where you can.

## Mapping types

<!-- source: platform/data/AvailableValue?Table=ImportTransformMapping&Field=Type -->
| Type | Description |
| --- | --- |
| Copy | Copies the source value to the target field unchanged. |
| Lookup | Finds the record in **Lookup table** whose **Lookup field** equals the source value and sets the reference field to it. The lookup field does not have to be the display value, but it should be unique. |
| Lookup Multiple | Like Lookup, for a multi-reference field. Separate several values with a pipe, for example `Group1\|Group2\|CAB`. A quoted, comma-separated list also works. |
| Transform | Runs **Script** and sets the target field to the `answer` it returns. |

A lookup that finds nothing, or finds more than one record, leaves the field unset and writes a warning to the load log. A single reference field takes only the first value of a multiple lookup.

## Transform script variables

The Transform type's script can use the Table API to look up other records. It has these variables:

| Variable | Description |
| --- | --- |
| `value` | The string value of the source field for this row. |
| `row` | The row's fields and their string values, keyed by field name, such as `row.FirstName`. |
| `rowIndex` | The position of the row in the load, starting at 1. |
| `rowRec` | The staging table record for the row, for anything `row` does not hold. |
| `current` | The target record. Read it for related information, but do not change it here. |
| `log` | A logger that writes entries to the import load log. |
| `mapping` | The current field mapping record. |
| `targetTable` | The name of the target table. |
| `answer` | Set this to the value for the target field. |

For example, `answer = \`${row.FirstName} ${row.LastName}\`;` sets a full name from two columns.

### Map a choice label to its key

If the source holds a choice field's label and not its key, look the key up in `AvailableValue`:

```javascript
if (value) {
    let availableValueRec = Table("AvailableValue")
        .AND(
            EQUAL("Table", mapping.Parent().Target()),
            EQUAL("Field", mapping.TargetField()),
            EQUAL("Value", value)
        )
        .query();
    if (availableValueRec.next()) {
        answer = availableValueRec.Key.value();
    } else {
        answer = "";
    }
} else {
    answer = "";
}
```

## Pre-process script variables

The pre-process script runs before the mappings of each row. Set `answer` to `SKIP` or `false` to skip the row.

| Variable | Description |
| --- | --- |
| `row` | The row's fields and their string values, such as `row.Description`. |
| `rowIndex` | The position of the row in the load, starting at 1. |
| `rowRec` | The staging table record for the row. |
| `current` | The target record. Read it, but do not change it here. |
| `log` | A logger that writes entries to the import load log. |
| `targetTable` | The name of the target table. |
| `answer` | Set to `SKIP` or `false` to skip the row. |

### Skip a row

```javascript
if (row.UserName == "admin") {
    answer = SKIP;
}
```

### Turn off checks on the target record

Apply [TableProtected and TableChecks](page:api/scripting/records/table-checks) to the target record, for example to stop triggers running:

```javascript
current.disableTriggers();
let checksToUse = TableChecks.NoTableChecksNoSystemFieldsNoChecksNoEvents.withEvaluateFieldValues(true);
current.tableChecks(checksToUse);
```

The **Suppress triggers**, **Suppress validation** and **Suppress audit** fields do the same for the whole transform map without a script.

## Post-process script variables

The post-process script runs after each row is written to the target.

| Variable | Description |
| --- | --- |
| `row` | The row's fields and their string values, such as `row.Description`. |
| `rowIndex` | The position of the row in the load, starting at 1. |
| `rowRec` | The staging table record for the row. |
| `current` | The target record. You can change it here. Call `update()` to save, or pass `true` as the third argument of `Workflow.forceToActivity()`. |
| `log` | A logger that writes entries to the import load log. |
| `targetTable` | The name of the target table. |

### Move a record to a workflow status

```javascript
Workflow.forceToActivity("Closed", current, true, false);
```

## Related

- [How data import works](page:data-import/how-data-import-works)
- [Import a spreadsheet](page:data-import/import-a-spreadsheet)
- [Schedule imports](page:data-import/schedule-imports)
- [Table](page:api/scripting/records/table)
