<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE smbxml SYSTEM "http://www.netsuite.com/xml/dtd/smb_4_06.dtd">
<!--
smbXML Contact Record Import Example

Before attempting to import any example smbXML documents, NetSuite strongly suggests you read the smbXML Developer's Guide. This guide can be found on the Support tab of your account and on the NetSuite Web site at Partners > Developer Program > Technical Documentation. The Developer's Guide explains how to construct smbXML documents.

The Document Type Definition (DTD) defines the format used for smbXML documents imported into your NetSuite account. These documents can contain additions, updates and queries of NetSuite records and transactions. The DTD specifies required fields, field order and XML element and attribute structures. The DTD is your guideline for creating smbXML documents. The current DTD can be found on NetSuite's Web site at Partners > Developer Program > Technical Documentation.

This sample file provides a complete contact record import example, including mandatory and optional contact elements. A contact record import contains several references to objects that must already exist in your NetSuite account. Any objects referenced in this example that are available for import with smbXML are created prior to the example. This is necessary for the import to be successful.

Any referenced objects that cannot be created with smbXML must be created using the NetSuite user interface (UI) prior to importing the example. These situations are noted as they occur and instructions for creating the objects in the UI are included.-->

<!--
NetSuite IPR Software Notice
Copyright (c) 2000-2003 NetSuite, Inc. All Rights Reserved.-->

<smbxml missingFieldOverwrite="false">
	<!--The smbxml element may have multiple request elements.

Setting the missingFieldOverwrite attribute to false tells NetSuite to ignore missing elements on import and not to alter information in fields not included in the imported file. If this attribute is set to true, then any elements not included in your smbXML file will be erased upon import. Setting the missingFieldOverwrite attribute at the smbxml element level applies the setting to the entire import. This attribute can be overridden at the request element level. Detailed information on this attribute is provided in the smbXML Developer's Guide.-->
	<!--Multiple request elements are allowed in a single smbXML document. Each request may only have one add, addOrUpdate or query command. Each command may only have one record.-->
	<request>
		<!--Add a customer to be referenced on the contact record.-->
		<addOrUpdate>
			<!--An addOrUpdate request looks for the existence of an object (in this case, a customer) matching the handle or ID of the object being added. If it finds a match the information is updated for the existing object. If there is no match, a new object is created. We want to make certain the customer record exists in the system prior to referencing it on the contact record. If the customer record does not exist prior to the import of the contact record, the record will fail to import. 

The following example represents a very minimal import for a customer record, but it is enough to allow us to import the contact record below. Customer records may also be created through the UI at Lists > Customers > New. For a complete example of a customer record import, see the smbXML Customer Record Example.-->
			<customer handle="CUST4178">
				<entityId>American Framing</entityId>
			</customer>
		</addOrUpdate>
	</request>
	<!--Add a contact to be referenced as a supervisor on this contact record.-->
	<request>
		<addOrUpdate>
			<contact handle="CONT7895">
				<entityId>Blair Henderson</entityId>
			</contact>
		</addOrUpdate>
	</request>
	<!--Add another contact to be referenced as an assistant on the contact record.-->
	<request>
		<addOrUpdate>
			<contact handle="CONT4568">
				<entityId>Charlie Patterson</entityId>
			</contact>
		</addOrUpdate>
	</request>
	<!--Add a contact record. -->
	<!--Below is a list of the mandatory and optional references used in a contact record import. This list also includes information about where the objects being referenced may be created.

	Mandatory References:
		-	contactTypeRef		created in the UI only
		
	Optional References:
		-	companyRef			created in the UI or via smbXML
		-	supervisorRef			created in the UI or via smbXML
		- 	assistantRef			created in the UI or via smbXML
		
Note that for each of these references, where allowed, we have chosen to use handle references. Handle references are more precise and easier to use.-->
	<request>
		<addOrUpdate>
			<!--We use an addOrUpdate command here to indicate that if a contact record already existing for this contact, the information should be updated. If a record does not exist, a new record will be created.-->
			<contact handle="CONT2587">
			<!--The contact element is used to indicate the object you are adding or updating with this request. You can use the handle attribute to create a handle for your contact record with the contact element. Creating this handle allows you to reference this item in other smbXML documents using handle references. -->
				<entityId>Jamie Pardue</entityId>
				<!--The entityId element is your contact's name or ID number. This element is required unless you use auto-generated numbers. This element populates the Contact field on contact records and has a maximum length of 80 characters. -->
				<title>Warehouse Manager</title>
				<!--The title element is used to record this contact's job title. This element is not required and the information entered populates the Job Title field on contact records. This maximum length for this field is 30 characters. -->
				<salutation>Mr.</salutation>
				<!--The salutation element is used to enter a salutation to begin this contact's name. This element is not required and the information populates the Mr./Mrs... field on contact records. The maximum length for this field is 15 characters. -->
				<firstName>Jamie</firstName>
				<!--The firstName element is used to record this contact's first name. This element is not required and the information entered populates the First Name field on contact records. The maximum length for this field is 25 characters. -->
				<middleName>Leon</middleName>
				<!--The middleName element is used to record this contact's middle name. This element is not required and the information entered populates the Middle Name field on contact records. The maximum length for this field is 25 characters.-->
				<lastName>Pardue</lastName>
				<!--The lastName element is used to record this contacts last name. This element is not required and the information entered populates the Last Name field on contact records. The maximum length for this field is 25 characters. -->
				<companyHandle handle="CUST4178"/>
				<!--The companyHandle element is a handle reference to a company record that already exists in NetSuite. This particular company is a customer and the record was created at the beginning of this example file. If you do not know the handle for the company record being referenced, you can use a name reference.

When using a name reference to reference a company name in a contact record, you must include the type of company you are referencing. The only valid company types for smbXML are customer and vendor.

To use a name reference for the company above, enter the following elements:
				<companyRef>
					<name type="customer">American Framing</name>
				</companyRef>
				
Using a handle reference eliminates the need to specify the company's type.

If this company record is a child of existing customers, you must include a parentRef or parentHandle for each parent record. If any of the parent records were created in the UI, a name reference must be used unless the parent handles can be determined with a query.

To use name references for a company reference with parent records, enter the following elements:
				<companyRef>
					<parentName>All About Art</parentName>
					<parentName>Framing Divisions</parentName>
					<name type="customer">American Framing</name>
				</companyRef>

The top-level parent record is listed first and each level is listed in descending order. These parent records must exist in NetSuite prior to importing your file and the name references must match the record names identically.-->
				<contactTypeList>
					<!--The contactType List element indicates the beginning of a list of contact types. This element is used because you can select multiple contact types for a single contact record. This element is required. -->
					<contactTypeRef>
						<name>Customer</name>
					</contactTypeRef>
					<!--The contactTypeRef is used to select the type of contact for this contact record.  Contact Types can only be created in the UI. The selected contact type must exist in NetSuite prior to importing your records. If the contact type does not exist, the import will fail. To create new contact types, go to Lists > Other Lists > New > Contact Type.

 You can select multiple types by entering multiple contactTypeRef elements. For example, if you also wanted to select Employee as a type for this contact, you would enter the following elements:
					<contactTypeRef>
						<name>Employee</name>
					</contactTypeRef>-->
				</contactTypeList>
				<email>jamie@americanframing.com</email>
				<!--The email element is the e-mail address of this contact. This element is not required. The information populates the E-mail field on contact records and this field has a maximum length of 64 characters. The information entered in this field must conform to standard e-mail address format. I.e. name@domain.com -->
				<altEmail>jaime@mail.com</altEmail>
				<!--The altEmail element is used to record an additional e-mail address for this contact. The altEmail element conforms to the same guidelines as the email element above. -->
				<phone>555-650-1894</phone>
				<!--The phone element is the primary telephone number for this contact. This element is not required and the information populates the Phone field on contact records. The Phone field has a maximum length of 21 characters. -->
				<officePhone>555-354-4785</officePhone>
				<!--The officePhone field is a place to enter an additional telephone number for this contact. This element follows the same guidelines as the phone element. -->
				<homePhone>555-423-2565</homePhone>
				<!--The homePhone field is a place to enter an additional telephone number for this contact. This element follows the same guidelines as the phone element. -->
				<mobilePhone>555-650-1458</mobilePhone>
				<!--The mobilePhone field is a place to enter an additional telephone number for this contact. This element follows the same guidelines as the phone element. -->
				<fax>555-681-4574</fax>
				<!--The fax element is the fax number for this contact. If you use NetSuite's faxing capabilities, this number is used when faxing transaction through NetSuite. You can set up NetSuite's faxing capabilities at Setup > Set Up Printing, Fax & E-mail. This element is not required and the information populates the Fax field on contact records. The Fax field has a maximum length of 21 characters. -->
				<supervisorHandle handle="CONT7895"/>
				<!--The supervisorHandle element is a handle reference to a contact record that already exists in NetSuite. This particular contact was created at the beginning of this example file. If you do not know the handle for the contact record being referenced, you can use a name reference.

To use a name reference for the contact above, enter the following elements:
				<supervisorRef>
					<name>Blair Henderson</name>
				</supervisorRef> -->
				<supervisorPhone>555-742-1245</supervisorPhone>
				<!--The supervisorPhone element is used to record the phone number of the contact selected in the Supervisor field. This element is not required and the information entered populates the Sup. Phone field on contact records. This field has a maximum length of 21 characters. -->
				<assistantHandle handle="CONT4568"/>
				<!--The assistantHandle element is a handle reference to a contact record that already exists in NetSuite. This particular contact was created at the beginning of this example file. If you do not know the handle for the contact record being referenced, you can use a name reference.

To use a name reference for the contact above, enter the following elements:
				<assistantRef>
					<name>Charlie Patterson</name>
				</assistantRef> -->
				<assistantPhone>555-875-2489</assistantPhone>
				<!--The assitantPhone element is used to record the phone number of the contact selected in the Assistant field. This element is not required and the information entered populates the Assist. Phone field on contact records. This field has a maximum length of 21 characters. -->
				<comments>This is an example of a comment.&#xD;This sentence will be on a new line.</comments>
				<!--The comments element is not required. The information entered populates the Comments field on contact records. The Comments field is a multi-line string with a 999 characters maximum length. You may use the new line string &#xD; to separate lines. -->
				<isInactive>false</isInactive>
				<!--The isInactive element is used to indicate if a contact is inactive. This element is not required and the information populates the Contact is Inactive field on contact records. Because this field is a check box and records a true or false value, you must enter either true or false for this element. If you choose to enter true for this element, the contact record is inactive. The record will not appear in lists or be available on transactions. -->
				<!--If you use the Marketing Automation feature, you can unsubscribe contacts from marketing campaigns with smbXML. However, you cannot subscribe contacts to marketing campaigns using smbXML. To enable Marketing Automation, go to Setup > Enable Features > CRM. Check the Marketing Automation box, agree to NetSuite's term and click Save. To unsubscribe a contact from marketing campaigns, enter the following elements:
				<unsubscribe>false</unsubscribe>
				
The unsubscribe element should always contain a false entry, otherwise you will receive an error when importing your smbXML file. -->
				<addressList>
					<!--The addressList element is used to indicate to NetSuite that you are beginning a list of addresses for this contact record. In NetSuite, it is possible to enter multiple addresses for a single contact record. This element is only required if you are including addresses in your import. -->
					<addressLine>
						<!--The addressLine element is used to indicate to NetSuite that you are beginning a line in your address list. This element should be placed before each individual address. This element is only required if you are including addresses in your import. -->
						<addressName>Warehouse</addressName>
						<!--The addressName element is used to name this particular address. This is the name that appears in the address select field on transactions. This element is not required and the information populates the Label field on contact records. The maximum length for this field is 50 characters. -->
						<attention>Jamie Pardue</attention>
						<!--The attention element is used to add a specific person's name to this address. This element is not required and the information populates the Attention column of the address list on contact records. The maximum length for this field is 50 characters. -->
						<addressee>American Framing</addressee>
						<!--The addressee element is used to add the name of this contact or business. This element is not required and the information populates the Addressee column of the address list on contact records. The maximum length for this field is 50 characters. -->
						<line1>4547 Lexington Street</line1>
						<!--The line1 element is used to enter the first line of the street address. This element is not required and the information populates the Address 1 column of the address list on contact records. The maximum length for this field is 50 characters. -->
						<line2>Building 75</line2>
						<!--The line2 element is used to enter additional address information���such as a suite or box number. This element is not required and the information populates the Address 2 column of the address list on contact records. The maximum length for this field is 50 characters. -->
						<city>Dinuba</city>
						<!--The city element is used to enter the city for this address. This element is not required and the information populates the City column of the address list on contact records. The maximum length for this field is 50 characters. -->
						<state>CA</state>
						<!--The state element is used to choose a state or province for this address. This element is not required and the information populates the Province/State column of the address list on contact records. 

When entering information for this element, the standard, two-letter state or province abbreviations must be used. If these abbreviations are not used, it will not result in an error. However, the Province/State field will remain blank upon import. For a complete list of state and province abbreviations, see the Appendix of the smbXML Developer's Guide. -->
						<zipCode>94587</zipCode>
						<!--The zipCode element is used to enter a postal zip code for this address. This element is not required and the information populates the Zip column of the address list on contact records. The maximum length for this field is 13 characters. -->
						<country>US</country>
						<!--The county element is used to choose a country for this address. This element is not required and the information populates the Country column of the address list on contact records. 

When entering information for this element, the standard, two-letter country codes must be used. If these abbreviations are not used, it will not result in an error. However, the Country field will remain blank upon import. For a complete list of country codes, see the Appendix of the smbXML Developer's Guide. -->
						<phone>555-650-1894</phone>
						<!--The phone element is used to enter a contact number for this address. This element in not required and the information populates the Phone field of the address list on contact records. The maximum length for this field is 21 characters. -->
						<defaultBilling>false</defaultBilling>
						<!--The defaultBilling element is used to indicate that this address is the default billing address for this contact. This element is not required and the information populates the Default Billing column of the address list on contact records. Because this field is a check box and records a true or false value, you must enter either true or false for this element. If this element is not included, the field defaults to true. -->
						<defaultShipping>true</defaultShipping>
						<!--The defaultShipping element is used to indicate that this address is the default Shipping address for this contact. This element is not required and the information populates the Default Shipping column of the address list on contact records. Because this field is a check box and records a true or false value, you must enter either true or false for this element.  If this element is not included, the field defaults to true. -->
						<addressText>Jaime Pardue&#xD;American Framing&#xD;Warehouse&#xD;4547 Lexington Street&#xD;Dinuba, CA  94587</addressText>
						<!--The addressText element is used to enter the exact information you want to appear in address fields on transactions when this address is chosen for this contact. This element is not required and the information populates the Address column of the address list on contact records. If you do not enter any information for this element, the information entered for attention, addressee, line1, line2, city, state, zipCode and country is entered in this field. -->
					</addressLine>
					<!--Add another address for this contact record. -->
					<addressLine>
						<addressName>Home</addressName>
						<addressee>Jamie Pardue</addressee>
						<line1>1748 Mallard Street</line1>
						<line2>Apartment 4C</line2>
						<city>Dinuba</city>
						<state>CA</state>
						<zipCode>94587</zipCode>
						<country>US</country>
						<phone>555-423-2565</phone>
						<defaultBilling>false</defaultBilling>
						<defaultShipping>false</defaultShipping>
						<addressText>Jaime Pardue&#xD;&#xD;1748 Mallard Street&#xD;Apartment 4C&#xD;Dinuba, CA  94587</addressText>
					</addressLine>
				</addressList>
			</contact>
		</addOrUpdate>
	</request>
</smbxml>
<!--
	To import an XML file:
	1. Click the Transactions tab.
	2. On the Transactions tab, under the Other heading, click Submit XML Document.
	3. Click Browse.
	4. Locate your smbXML field and select it.
	5. Click Submit. 
	
	You will see a status bar with the import progress. Once the import is complete, a message appears below the status bar indicating if there are any errors. You will also have the opportunity to download and view the XML response file from NetSuite. The response file lists any errors you may have received and acknowledgements for successful imports.

If you received any errors, you can edit your file to correct the errors and import the file again. Any requests that were successful do not need to be imported again. 

For more information about constructing and importing XML documents, see the Developer's Guide on the NetSuite Web site at Partners > Developer Program > Technical Documentation. -->