Defining Record and Field Mappings for Saved CSV Import Maps in XML Definitions

When your users import CSV files, the data is imported based on the mappings you define for records and fields. In SuiteCloud Development Framework (SDF), the record and field mappings are defined in the savedcsvimport SDF custom object.

To define mappings, see the following topics:

Consider the following when creating mappings:

Record Mappings

Record mappings are defined using a collection of recordmapping elements with the recordmappings element.

For more information about records, see the following topics:

Note:

During deployment, the internal IDs for records are based on values in the target account and not the values in the CSV file. If needed, you can override those IDs by using SuiteBundler to deploy the object.

The following example defines recordmappings for the SALESORDER record type and SALESORDER:ITEMS subrecord type.

            <recordmappings>
    <recordmapping>
        <record>SALESORDER</record>
        <fieldmappings>
...
        </fieldmappings>
    </recordmapping>
    <recordmapping>
        <record>SALESORDER:ITEMS</record>
        <fieldmappings>
...
        </fieldmappings>
    </recordmapping>
</recordmappings> 

          

For examples of field mappings, see Field Mappings. For a complete savedcsvimport SDF custom object example, see Saved CSV Import Maps XML Definition Example.

The line element is used with the recordmapping element when sourcing a list from a single file. You should use the NetSuite user interface Import Assistant to ensure the CSV columns are correctly mapped to lines. When line element is used, there is no value for the filemapping element.

The following example defines field mappings for two address lines in the customer contact address book:

            <recordmapping>
    <line>1</line>
    <record>CUSTOMERANDCONTACT:ADDRESSBOOK:ADDRESSBOOKADDRESS</record>
    <fieldmappings>
        <fieldmapping>
            <field>ADDR1</field>
            <columnreference>
                <column>street2</column>
                <file>CUSTOMERANDCONTACT</file>
                <type>NAME</type>
            </columnreference>
        </fieldmapping>
        <fieldmapping>
            <field>ADDR2</field>
            <columnreference>
                <column>city2</column>
                <file>CUSTOMERANDCONTACT</file>
                <type>NAME</type>
            </columnreference>
        </fieldmapping>
    </fieldmappings>
</recordmapping>
<recordmapping>
    <line>2</line>
    <record>CUSTOMERANDCONTACT:ADDRESSBOOK:ADDRESSBOOKADDRESS</record>
    <fieldmappings>
        <fieldmapping>
            <field>ADDR1</field>
            <columnreference>
                <column>street3</column>
                <file>CUSTOMERANDCONTACT</file>
                <type>NAME</type>
            </columnreference>
        </fieldmapping>
        <fieldmapping>
            <field>ADDR2</field>
            <columnreference>
                <column>city3</column>
                <file>CUSTOMERANDCONTACT</file>
                <type>NAME</type>
            </columnreference>
        </fieldmapping>
    </fieldmappings>
</recordmapping> 

          

Field Mappings

A field mapping is defined by the fieldmapping element as part of a fieldmappings collection, and grouped by record using the recordmapping element. For a list of fields and values, see savedcsvimport.

For information about field mappings, see the following:

Field mappings are defined by record type. For examples of record type mapping, see Record Mappings.

Field descriptions can be found in the SuiteTalk Schema Browser. Field information is also available in the NetSuite user interface form for the selected record type. You can click the field label to display help that describes the field.

To be available for mapping, the field must be both exposed to CSV import and available to you to map. You can use the NetSuite user interface Import Assistant to determine the fields that are available to you. The list of available fields can be impacted by your permissions and the features that are enabled for the target NetSuite account.

You can define a field mapping the following ways:

  • Specify the default value.

    In the following example, the STDEMAIL field is mapped to an email address as the default value.

                    <fieldmapping>
        <field>STDEMAIL</field>
        <value>jmiller@example.com</value>
    </fieldmapping> 
    
                  
  • Specify a null value.

    In the following example, the STDMEMO field is mapped to a null value.

                    <fieldmapping>
        <field>STDMEMO</field>
        <value/>
    </fieldmapping> 
    
                  
  • Map the field to a column in a CSV file.

    In the following example, the STDPHONE field is mapped to the Phone Number column in the SALESORDER CSV file.

                    <fieldmapping>
        <field>STDPHONE</field>
        <columnreference>
            <file>SALESORDER</file>
            <column>Phone Number</column>
        </columnreference>
    </fieldmapping> 
    
                  
  • Map the field to a column in a CSV file with the reference type.

    In the following example, the STDCUSTOMER field is mapped to the Customer EID column in the SALESORDER CSV file with a reference type of EXTERNAL_ID.

                    <fieldmapping>
        <field>STDCUSTOMER</field>
        <columnreference>
            <file>SALESORDER</file>
            <column>Customer EID</column>
            <type>EXTERNAL_ID</type>
        </columnreference>
    </fieldmapping> 
    
                  

For a complete savedcsvimport SDF custom object example, see Saved CSV Import Maps XML Definition Example.

Related Topics

Saved CSV Import Maps as XML Definitions
Defining Import Options for Saved CSV Import Maps in XML Definitions
Defining File Mappings for Saved CSV Import Maps in XML Definitions
Saved CSV Import Maps XML Definition Example

General Notices