Thank you for your feedback.
Form temporarily unavailable. Please try again or contact docfeedback@servicenow.com to submit your comments.
Versions
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store
Close

Transformation script variables

Transformation script variables

Multiple variables can be used to define explicit mapping relationships in a transform map script.

Variable name Type Description
source Reference JavaScript variable available during Import Set scripting that can be used to reference a field's value in the source row being processed.
var x = source.incident_state;
Variable name Type Description
target Assignment JavaScript variable available during Import Set scripting that can be used to assign a field's value to the current target row being processed.
target.incident_state='active';
Variable name Type Description
map Reference Read-only information about the current transform map record. This variable supports querying the following columns from the sys_transform_map table.
  • name
  • sys_id
  • source_table
  • target_table
  • order
var x = map.order;
Variable name Type Description
log Function Log object for the current import run. For example, log.info( STRING ), log.warn( STRING ), log.error( STRING ).
log.info("An error has occurred"); 
log.warn("An error has occurred");
log.error("An error has occurred");
Variable name Type Description
action Function Returns a value of either "insert" or "update" indicating whether the current target row is about to be created or updated.
if(action =="insert")
    ignore =true;
Variable name Type Description
ignore Flag True = in onStart scripts, causes the entire transformation process to be skipped. Setting it to true in onBefore scripts causes the current row transformation to be skipped, and continues to process the remaining rows. Default is "false".
if(source.u_user_name.nil()){
   ignore = true;}
Variable name Type Description
error Flag True = causes the current import row to stop processing at any stage in processing and registers an error in the Import Set Log. Default is "false".
if(source.name=="no_tranform")
  error = true;
Variable name Type Description
error_message String (output message) When an error occurs, setting this value to a customized string value causes the SOAP response to contain an optional error_message field to be returned.
error_message = "ignore this error"
Variable name Type Description
status_message String (output message) Setting this value to a customized string value will cause the SOAP response to contain an optional status_message field to be returned.
status_message ="web service processed"