Transformation script variables & Scripting in Transform Maps.
Import
·
Jul 23, 2019
·
article
Scripting in Transform Maps :
Transform Scripts are just like Business Rules, there is no condition field, instead just a simple Type field that chooses when it should run:
- Before (onBefore) or after (onAfter) a record is inserted or updated in the target table.
- When the transform map starts processing (onStart) or when it stops (onComplete).
- When choices or reference values are created (onChoiceCreate, onForeignInsert, onReject). These are rarely used.
- onStart : The onStart event script is processed at the start of an import run, before any data rows are read.
- onComplete : The onComplete event script is processed at the end of an import run, after all data rows are read and transformed.
- onBefore : The onBefore event script is processed at the start of a row transformation, before the source row is transformed into the target row.
- onAfter : The onAfter event script is processed at the end of a row transformation, after the source row has been transformed into the target row and saved.
- onForeignInsert : The onForeignInsert event script is processed at the start of the creation of a related, referenced record, before the record is created.
- onChoiceCreate : The onChoiceCreate event script is processed at the start of a choice value creation, before the new choice value is created.
- onReject : The onReject event script is processed during the occurrence of a foreign record or choice creation, and the foreign record or choice is rejected, the entire transformation row is not saved.
Transformation script variables :
- source : Contains the import source record currently being transformed. Specify a specific field from the source record as an object property.
- target : Contains the import target record currently being inserted. Specify a specific field from the target record as an object property.
- map : Contains the transformation map record currently being used for the transformation process. Specify a specific field from the transform map record with one of these properties.
- log : Log information about the current import process. Each log level has its own method.
- action : Specify the transformation action occurring on the target record. This value can be either "insert" or "update".
- ignore : When set to true, skips or aborts the current import action. In onStart scripts, this variable aborts the entire transformation process. In onBefore scripts, this variable only skips the current row being transformed.
- error : When set to true, aborts the current import action and logs an error message in the Import Set Log.
- error_message :When an error occurs, adds the specified error message to SOAP response.
- status_message : Adds the specified status message to SOAP response.
Labels:
View original source
https://www.servicenow.com/community/developer-articles/transformation-script-variables-scripting-in-transform-maps/ta-p/2327820
