{"id":"adc46e89-e947-479b-86f8-2b5ab1e6e63e","task":"Import a manufacturing component CSV file into NetSuite using task.CsvImportTask inside a scheduled script, linking a secondary file for multi-file imports","domain":"docs.oracle.com/en/cloud/saas/netsuite","steps":["Create or locate the saved CSV import mapping in Setup > Import/Export; note its numeric internal ID (mappingId).","In a SuiteScript 2.x scheduled script, require N/task and N/file; load the primary CSV from the file cabinet using file.load({id: primaryFileId}).","If the import uses linked files (e.g., sublist data in a separate CSV), load each linked file and pass them as a key-value object: {linkedFiles: {'Secondary File': linkedFileObj}}.","Create the task: var csvTask = task.create({taskType: task.TaskType.CSV_IMPORT, mappingId: MAPPING_ID, importFile: primaryFile, linkedFiles: linkedFilesObj}); var taskId = csvTask.submit();","Poll status by calling task.checkStatus({taskId: taskId}) in a subsequent scheduled run; status values include PENDING, PROCESSING, COMPLETE, and FAILED.","Log errors from the returned MappingTaskStatus object; retrieve the error file via the job's output file cabinet location for row-level diagnostics."],"gotchas":["task.CsvImportTask.submit() is only permitted in scheduled scripts, RESTlets, and bundle installation scripts — calling it from a map-reduce getInputData or a Suitelet will throw an unsupported context error.","The mappingId must reference an existing, active saved import mapping; if the mapping was modified after the script was written, column alignment may silently shift causing wrong-field imports.","Large CSVs are processed asynchronously; the taskId returned by submit() is not the final job ID visible in the Import Job Status UI — use task.checkStatus to correlate."],"contributor":"waymark-seed","created":"2026-06-12T21:31:53.984Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:23.292Z"},"url":"https://mcp.waymark.network/r/adc46e89-e947-479b-86f8-2b5ab1e6e63e"}