Search Records in Quickbooks

Table of Contentsup

 Overview

The intuit.quickbooks.searchRecords() task is used to search records from any of the supported modules in your QuickBooks account, directly from your Zoho Creator Application.  For example, you can search for customers from the Customer module in quiockbooks with a given display name.  To connect Zoho Creator with QuickBooks, create a new connection from the Setup - Connections page. 

 Supported Modules

  • Customer
  • Vendor
  • Item
  • Invoice
  • Account
  • Employee
  • Department

 Syntax

<quickbooksResponse> = intuit.quickbooks.searchRecords(<quickbooksConnectionName>,,<quickbooks CompanyId> , <Select Query>);

where, 
<quickbooksResponse> is the map variable returned as response. It contains the details of the fetched records. 
<quickbooksConnectionName> referes to the connection name used to connect Zoho Creator with Quickbooks. Create a new connection from the Setup - Connections page. 
<quickbooksCompanyId> refers to the unique ID generated by Quickbooks for each account. You can find this under Your Company -> Account and Settings -> Billing & Subscription -> Company Id in your Quickbooks account.
<Select Query> in the format,
select <requiredColumns> from <moduleName> where <attribute name> = <value> 
Refer the Quickboks API Guide for the attributes to be specified for each module.

 Example - Search records from quickbooks

A sample script to search records from the Quickbooks customer module with a given display name, is given below. You can execute this script from a Zoho Creator form by adding it to the required Form Actions block.  For example, to search for specific records from the customer module, 

//returns a list of records with DisplayName ="Henry"
searchResponse = intuit.quickbooks.searchRecords("Zoho", "1241802285", "SELECT * FROM Customer where DisplayName='Henry'");
 

 Example - Get ID of the records

queryResponse = (searchResponse.get("QueryResponse")).toMap();
queryResponseList = queryResponse.get("Customer").toJSONList();
//iterate each value in list
for each rec in queryResponseList
{
recMap = rec.toMap();
id = recMap.get("Id");
info id ;
}

Note

  • You can add the script directly to the editor area by selecting Free-flow scripting link displayed on the top-right corner of the script builder ( or ) use the drag-and-drop functionality in Script Builder.

 Response Format

The response returned by Quickbooks will be in the format given below.

{
“time":"2014-08-06T04:45:08.234-07:00",
"QueryResponse":"{" Customer":"[{" ShipAddr":{
"Line3":"123 street",
"Long":"-122.0960826",
"Line2":"Building 1",
"Line1":"Intuit",
"Lat":"37.4306346",
"Id":"7"
},
"PreferredDeliveryMethod":"Email",
"BalanceWithJobs":0,
"DisplayName":"Henry",
"FullyQualifiedName":"Henry",
"BillWithParent":false,
"Job":false,
"Active":true,
"MetaData":{
"CreateTime":"2014-08-01T02:29:29-07:00",
"LastUpdatedTime":"2014-08-01T02:35:45-07:00"
},
"Taxable":false,
"BillAddr":{
"Long":"-77.02225539999999",
"Line1":"450 7th StreetnWashington DC",
"Lat":"38.8958239",
"Id":"6"
},
"domain":"QBO",
"SyncToken":"1",
"PrintOnCheckName":"Hudson",
"CurrencyRef":{
"name":"Indian Rupee",
"value":"INR"
},
"Id":"5",
"FamilyName":"Hudson",
"Balance":0,
"sparse":false
}
]","maxResults":1,
"startPosition":1
}
}

If for some reason, the execution fails, the response will be in the following format.

ERROR RESPONSE - For Invalid Parameter Name

{
"Error":"[{
"Detail":"Property Name:Can not instanti specified is unsupported or invalid",
"Message":"Request has invalid or unsupported property",
"code":"2010"
}]"
}

 Using Script Builder

To add the script using the drag-n-drop functionality in Script Builder,

  1. Select the Form from your Dashboard page
  2. Select the required Form Action from Settings - Workflow.
  3. Click on Script Builder from the top-right corner of the page.
  4. Drag and drop the call function in the editor box. 
  5. Select Integration tasks
  6. Select Service as Quickbooks
  7. Select Function as Search Records.
  8. Select the Connection Name to connect with Quickbooks. Click on +Create to create a new connection or create a new connection from the Setup - Connections page
  9. Specify the unique Company ID of your Quickbooks account. Refer CompanyId for more information.
  10. Specify the select query to fetch the records.
  11. Specify the response variable that will hold the response returned by Quickbooks.
  12. Click on Done to insert the call function task.


The response variable will contain the response returned by Quickbooks in list format.