OnStart Transform Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 03:58 AM
Hi Team,
I have added a condition in onstart transform script where it should give an error message if the excel file contains more than 50 records just a example. So the Condition is satisfied and entered to the if loop but not able to see the error message.
Below is the code written in Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 04:08 AM
Hello @Apoorva A H ,
You can try below script :
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2025 04:10 AM
error message will be seen in system logs and import logs.
did you check if system property "glide.importlog.log_to_table" is true?
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-26-2025 04:28 AM
try this
1) use import_set object which is the import set object, it will give you count and not the source object
2) try using error = true and error_message along with log.error()
3) ensure that system property is true "glide.importlog.log_to_table"
var limit = parseInt(gs.getProperty('x_amspi_payroll_up.acn.bulk_request.payroll_asset_limit'));
var sourceCount = import_set.getRowCount();
if (sourceCount > limit) {
log.error('Number of records in source and limit ' + sourceCount + ' ' + limit, 'acnBulkRequest.' + map.name);
error = true;
error_message = 'Import aborted: Number of records (' + sourceCount + ') exceeds the allowed limit (' + limit + ').';
ignore = true;
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-26-2025 08:09 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader