- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2021 07:20 AM
Hi, I am creating a scoped application for integration and have few transform maps. I want to run a transform map only if the target table exists. can we do that through scripting? thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2021 06:44 AM
Hi,
Glad to know that it worked.
Please use onStart transform script so that entire transformation is skipped if table not found
Also you should use ! operator in the gs.tableExists('table_name')
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(!gs.tableExists('table_name')) {
ignore = true;
log.info('Table not found so entire transformation is skipped');
}
})(source, map, log, target);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2021 04:17 AM
I didn't change the Accessible from for that Script Include.
Directly used this
gs.tableExists('incident')
Are you able to use the above single line
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2021 06:16 AM
this works! sorry, I had some typo i guess.
so my script for onbefore transform is
if (gs.tableExists('table_name')) {
ignore = true;
}
still the transform map is failing. is there something I am missing?
Thank you so much again. you are saving my time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-03-2021 06:44 AM
Hi,
Glad to know that it worked.
Please use onStart transform script so that entire transformation is skipped if table not found
Also you should use ! operator in the gs.tableExists('table_name')
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
if(!gs.tableExists('table_name')) {
ignore = true;
log.info('Table not found so entire transformation is skipped');
}
})(source, map, log, target);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader