Skip to main content

system.mes.inventory.operation.importFromCsv

Description

Imports Inventory Operations from a CSV file provided as raw bytes. The service layer will parse the CSV content and create or update inventory operation entities.

Recommended to export at least one pre-existing inventory operation to CSV using the exportAsCsv functionality to ensure the correct format of the CSV file.

Syntax

system.mes.inventory.operation.importFromCsv(importBytes)

Parameters

ParameterTypeNullableDescription
importBytesPyArrayFalseThe CSV content as raw bytes.

Returns

An ApiResponse object where data is the number of inventory operations successfully imported or updated.

Code Examples

Here is an example of how to use the importFromCsv method in the context of a Perspective File Upload Component onFileReceived event handler. Reference Perspective - File Upload Scripting for more information on the onFileReceived event handler.

def runAction(self, event):
csvBytes = event.file.getBytes()
system.mes.inventory.operation.importFromCsv(csvBytes)