Discussions
Join the NetSuite community to innovate, connect, and discover what’s next.
SuiteWorld brings thousands of innovators, builders, and leaders together to learn, connect, and shape what’s next. This October, explore how to build a stronger foundation for growth through inspiring keynotes, major product reveals, hands-on sessions, and unforgettable moments—all in one place for our biggest event of the year. Register now
Retrieve CSV Import errors using Restlet
I want to retrieve the errors for a CSV Import job. Co-pilot suggested I could use this code but it fails on 'search.create' - I am guessing cause there is an issue with 'csvimporterror' which I do not see as a valid type. Can this code be fixed or is there some other code that will do the job?
function getErrors(requestParams) {
var jobId = requestParams.jobId;
var errorSearch = search.create({
type: 'csvimporterror',
filters: [
['csvimportjob', 'is', jobId]
],
columns: ['line', 'errormessage']
});
var errors = [];
errorSearch.run().each(function(result) {
errors.push({
line: result.getValue('line'),
errorMessage: result.getValue('errormessage')
});
return true;
});
return errors;