Is there any way to get CSV import status in Suite...
# suitescript
l
Is there any way to get CSV import status in SuiteScript 2.0?
n
Tried this? task.CsvImportTaskStatus "Encapsulates the status of a CSV import task placed into the NetSuite scheduling queue. Use task.checkStatus(options) with the unique ID for the CSV import task to get the 
CsvImportTaskStatus
 object. For a complete list of this object’s properties, see CsvImportTaskStatus Object Members."
Copy code
var csvTaskStatus = task.checkStatus({
    taskId: csvTaskId
    });
if (csvTaskStatus.status === task.TaskStatus.FAILED)
and:
Copy code
var summary = task.checkStatus({
    taskId: scriptTaskId
    });
log.audit({
    title: 'Status', 
    details: summary.status
    });
It's part of the N/task module
l
Wow
@Nik Thanks I'll try this
Ok, But I need complete status
this is for failed one
n
maybe look in help at the task.TaskStatus enum to see what you need to evaluate it as?
n
@Lucas but the second code snippet above checks the status, no? it's not just for failed?
l
@NElliott @Nikola Gavric
Copy code
var summary = task.checkStatus({
    taskId: scriptTaskId
    });
in this I am only getting initial status i.e pending one
not the processing and complete not sure why
b
you need to check the status at a later time
n
Yeah what @battk says, need to check it regularly just like when you update the status page in the UI
n
@Lucas You need to understand what the various statuses you can expect to see and what they mean. Once you do, you'll have a better chance of creating what you're aiming for.