- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-16-2022 06:32 AM
How do I know that whether record is inserted or updated using transform map script
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-16-2022 09:04 AM
So if you use an onBefore script there is an "action" variable that will tell you if its going to update or insert a new record.
https://docs.servicenow.com/bundle/sandiego-platform-administration/page/script/server-scripting/reference/r_MapWithTransformationEventScripts.html

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-16-2022 06:52 AM
You can't figure if it is inserted or updated using transform map script. You can add a log and check the status.
If you want to know whether record is created or updated using the transform map, you can go to System Import Sets > Advanced > Import Sets. Open the import set executed. You will see the data in Import Set Rows related list
Thank you,
Palani
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-16-2022 08:15 AM
cant I use action=='update'/action=='insert' in onAfter Script OR isUpdate==true in run script??

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-16-2022 07:22 AM
Hi,
You can use getRowCount() function to get the number of records in the table before and after insert so you can know if record is inserted or not.
Example
var now_GR = new GlideRecord('incident');
now_GR.addQuery('active','true');
now_GR.query();
gs.info("Records in incident table: " + now_GR.getRowCount()); //this will print number of records with above applied filters
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
â05-16-2022 09:04 AM
So if you use an onBefore script there is an "action" variable that will tell you if its going to update or insert a new record.
https://docs.servicenow.com/bundle/sandiego-platform-administration/page/script/server-scripting/reference/r_MapWithTransformationEventScripts.html