Transform map...scripting

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 01:36 PM
Hello all,
I'm drawing a blank on this.
Here's the scenario:
- I have an excel doc w/ 5000+ records
- Each record is categorized by 'device type' (router, server, chassis, etc)
- I've loaded the data just fine
- I created a transform map for 'chassis' only
- I'll create other transform maps for the other device types
- Source table == loaded data table
- Target table == custom Chassis table
- In this transform map, I've created the field maps (this is goodness)
- I checked 'Run Script' because I only want to import records into the Chassis table where source.u_device_type == 'Chassis'
- PROBLEM: what do i put in the script window to only look at the records in the import table where device type == 'Chassis'?
Thanks!
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2017 01:43 PM
Hello Matthew,
You should have the logic in the transformation script of type "OnStart" i.e when field should be OnStart.
Transform Map Scripts - ServiceNow Wiki
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2017 08:36 AM
Matthew: As Pradeep said you can use the OnStart Script...the run script that you mention will work also. In the script you need an if statement:
if(source.u_YOUR_FIELD_HERE != 'Chassis'){
ignore = true;
}
This will move pass that record and on to the next.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-03-2017 08:59 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2017 06:19 AM
All-
I ended up doing an onBefore Transform Map Script because with onStart, if 'ignore' comes back with a 'true' response, the rest of the import is ignored. If I use onBefore, and ignore = 'true', then just that record is ignored and it continues with the import.
all is good so far
Thanks much