Run The Transform Map Only If There's Incoming Record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2022 11:53 PM
Hello,
I had a requirement to integrate Servicenow and a 3rd party tool via Data source of type JDBC which is working fine as expected to fetch the data from 3rd party tool and update/create records within Servicenow custom table. This custom table has got an active field which will make the incoming records active otherwise inactive. To achieve this inactive/active mehanism of records, we are making all the records on the custom table inactive using onstart transform script post which all incoming records will be made active using field maps
This Data source has been included in the scheduled imports to run on a daily basis. Is there a way to stop running this transform map if there are no records incoming as this is making all records inactive when the Mid Server is down and not running ?
In simple terms my ask here is "I want to run the transform map only if there are records incoming otherwise not". Please let me know if there's a way to achieve this. Thanks
Regards,
Himesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2022 12:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2022 12:30 AM
Hello
Thanks for the quick response.
May I know what script logic must be written in the condition to get the record count please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2022 04:29 AM
Hi
create a new Tag (label) record : System Definition >Tags>new
----------------------------------- Transform Script When: onBefore ----------------------------------
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
var tagSysId = 'tag Sys_ID';
if (action == 'insert') {
var gr = new GlideRecord('label_entry');
gr.initialize();
gr.table = target.getTableName() + '';
gr.label = tagSysId;
gr.table_key = target.sys_id + '';
gr.title = target.getDisplayValue();
gr.insert();
}
--------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-20-2022 12:40 AM
Hi,
you can check if the import set table has records or not in onStart and ignore the entire transformation if no rows.
regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader