Defining File Mappings for Saved CSV Import Maps in XML Definitions
In SuiteCloud Development Framework (SDF), the default is to define file mappings for the savedcsvimport
SDF custom object. The file mapping defines information about how the CSV file is processed during import. The CSV data is not included with the SDF custom object.
The filemapping
element contains the file
element, and a primary key or foreign key. For a list of fields and possible values, see savedcsvimport.
The file
element defines the NetSuite record type for the CSV file definition. For the list of possible record type values, see csvimport_recordtypes. For more information about records supported by saved CSV import maps, see Supported Record Types for CSV Import.
Single CSV File
When specifying field mappings for a single CSV file, a single file mapping is specified with no primary key or foreign key.
The following example defines a single file mapping for a CSV file that imports sales order data:
<filemappings>
<filemapping>
<file>SALESORDER</file>
</filemapping>
</filemappings>
Multiple CSV Files
When specifying field mappings for multiple CSV files, specify a file mapping for each CSV file using the filemapping
element for the filemappings
element.
Keys are used when there are multiple CSV files. The CSV file definition can contain a primary key for the primary CSV file, and a foreign key for the secondary CSV files. The primary key indicates how data is to be mapped between the primary and linked CSV files.
The following example defines file mappings for multiple CSV files:
<filemappings>
<filemapping>
<file>SALESORDER</file>
<primarykey>ID</primarykey>
</filemapping>
<filemapping>
<file>SALESORDER:ITEMS</file>
<foreignkey>Transaction ID</foreignkey>
</filemapping>
</filemappings>
The example defines CSV file mapping in the following way:
-
The SALESORDER file mapping contains sales order record data, with the ID column specified as the primary key in the SALESORDER CSV file.
-
The SALESORDER:ITEMS file mapping contains sales order item data, with the Transaction ID column specified as the foreign key in the SALESORDER:ITEMS CSV file.
For a complete savedcsvimport
SDF custom object example, see Saved CSV Import Maps XML Definition Example.