QbXML for Adding a Customer with Custom Fields

From ConsoliBYTE Wiki
Jump to: navigation, search

QuickBooks custom fields are called "DataExt" records in the API. Since DataExts are NOT actually part of the core Customer record, you use a completely separate request to add/update them.

Below you can see double request, where the first request creates the customer, and the second sets the custom fields for the customer.

qbXML Request

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="7.0"?>
<QBXML>
	<QBXMLMsgsRq onError="stopOnError">

		<CustomerAddRq requestID="Q3VzdG9tZXJBZGR8MTExMTIxMjE=">
			<CustomerAdd>
				<Name>Keith Palmer Jr.</Name>
				<FirstName>Keith</FirstName>
				<MiddleName></MiddleName>
				<LastName>Palmer Jr.</LastName>
				<BillAddress>
					<Addr1>134 Stonemill Road</Addr1>
					<City>Mansfield</City>
					<State>CT</State>
					<PostalCode>06268</PostalCode>
					<Country>USA</Country>
				</BillAddress>
				<Phone>999-99-9999</Phone>
				<Email>test@example.com</Email>
				<Contact>Keith Palmer Jr.</Contact>
			</CustomerAdd>
		</CustomerAddRq>
		
		<DataExtModRq>
			<DataExtMod>
				<OwnerID>0</OwnerID>
				<DataExtName>CustomerNumber</DataExtName>
				<ListDataExtType>Customer</ListDataExtType>
				<ListObjRef>
						<FullName>Keith Palmer Jr.</FullName>
				</ListObjRef>
				<DataExtValue>1234</DataExtValue>
			</DataExtMod>
		</DataExtModRq>
		
	</QBXMLMsgsRq>
</QBXML>

qbXML Response

todo