> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superoffice.com/llms.txt
> Use this file to discover all available pages before exploring further.

# NSImportAgent

> This agent can be used to import data into the system.

This agent can be used to import data into the system.

## Constructors

### NSImportAgent()

```crmscript theme={null}
NSImportAgent
```

This agent can be used to import data into the system.

## Methods

## CreateDefaultImportLine(Integer)

Creates a new empty import row with x count of values

```crmscript theme={null}
NSImportLine CreateDefaultImportLine(Integer countColumns)
```

**Returns:** [CRMScript.NetServer.NSImportLine](CRMScript.NetServer.NSImportLine)

**Example:**

```crmscript theme={null}
NSImportAgent agent;
Integer countColumns;
NSImportLine res = agent.CreateDefaultImportLine(countColumns);
```

## CreateErpImportData(NSArchiveRestrictionInfo\[],String\[],Integer,Integer)

Populates the ImportLines and columnDefs based from ERP system

```crmscript theme={null}
NSImportErpData CreateErpImportData(NSArchiveRestrictionInfo[] restriction, String[] columns, Integer connectionId, Integer erpActorType)
```

**Returns:** [CRMScript.NetServer.NSImportErpData](CRMScript.NetServer.NSImportErpData)

**Example:**

```crmscript theme={null}
NSImportAgent agent;
NSArchiveRestrictionInfo[] restriction;
String[] columns;
Integer connectionId;
Integer erpActorType;
NSImportErpData res = agent.CreateErpImportData(restriction, columns, connectionId, erpActorType);
```

## PreviewImport(NSImportLine\[],String\[],String,String)

Previews the import

```crmscript theme={null}
NSImportLine[] PreviewImport(NSImportLine[] importLines, String[] columnDefinition, String culture, String context)
```

**Returns:** [CRMScript.NetServer.NSImportLine](CRMScript.NetServer.NSImportLine)\[]

**Example:**

```crmscript theme={null}
NSImportAgent agent;
NSImportLine[] importLines;
String[] columnDefinition;
String culture;
String context;
NSImportLine[] res = agent.PreviewImport(importLines, columnDefinition, culture, context);
```

## SaveImport(NSImportLine\[],String\[],Bool,String,String)

Does the actual import

```crmscript theme={null}
Integer[] SaveImport(NSImportLine[] importLines, String[] columnDefinition, Bool createSelection, String culture, String context)
```

**Returns:** [CRMScript.Global.Integer](CRMScript.Global.Integer)\[]

**Example:**

```crmscript theme={null}
NSImportAgent agent;
NSImportLine[] importLines;
String[] columnDefinition;
Bool createSelection;
String culture;
String context;
Integer[] res = agent.SaveImport(importLines, columnDefinition, createSelection, culture, context);
```


## Related topics

- [SuperOffice.WebApi.Agents.ImportAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.ImportAgent.md)
- [SuperOffice.WebApi.Agents.IImportAgent](/en/api/reference/webapi/SuperOffice.WebApi.Agents.IImportAgent.md)
- [Save Import](/en/api/reference/restful/agent/import_agent/save-import.md)
- [Preview Import](/en/api/reference/restful/agent/import_agent/preview-import.md)
- [Create Default Import Line](/en/api/reference/restful/agent/import_agent/create-default-import-line.md)
- [Create Erp Import Data](/en/api/reference/restful/agent/import_agent/create-erp-import-data.md)
