Get Records

  Overview

The intuit.quickbooks.getRecords() task is used to get records from any of the supported modules in your QuickBooks account, directly from your Zoho CRM.  For example, you can get a list of customers from the Customer module in quickbooks with a given display name.  To connect Zoho CRM with QuickBooks, download and install the QuickBooks connector from the Zoho Marketplace .

  Supported Modules

The following Quickbooks modules are supported by the intuit.quickbooks task

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

  Syntax

<quickbooksResponse> = intuit.quickbooks.getRecords("zoho_quickbooks", <quickbooksModuleName>,<quickbooks CompanyId> , <criteria>, <columnsToBeSelected>);

where, 
<quickbooksResponse> is the map variable returned as response. It contains the details of the newly created record. 
<quickbooksModuleName> refers to the module name in Quick Books where the record is created. 
<quickbooksCompanyId> refers to the unique ID generated by Quickbooks for each account. Refer CompanyId  for more information.
<criteria> is the optional parameter based on which the records wll be fetched. The criteria must be in the format <attribute name> = <value>. For example, "DisplayName = 'Henry'"
<columnsToBeSelected> is the optional parameter which specifies the name of the attributes to be selected.
Refer the Quickboks API Guide  for the attributes to be specified for each module. 

  Example - Get records from quickbooks

Sample scripts to get records from the Quickbooks customer module are given below.

//returns all records in customer module
getResponse = intuit.quickbooks.getRecords("zoho_quickbooks", "Customer", "1241802285");

//returns a list of records with DisplayName ="Henry"
getResponse = intuit.quickbooks.getRecords("zoho_quickbooks", "Customer", "1241802285", "DisplayName='Henry'");

//returns the FamilyName and ID of the records with DisplayName ="Henry" 

fieldList = List();

fieldList.add("FamilyName");
fieldList.add("Id");
getResponse = intuit.quickbooks.getRecords("zoho_quickbooks", "Customer", "1241802285", "DisplayName = 'Henry'",fieldList);

  Example - Get ID of the records

queryResponse = (getResponse .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 for the getRecords task given below.
intuit.quickbooks.getRecords("zoho_quickbooks", "Customer", "1241802285", "DisplayName='Henry'");

{
“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"
}]"
}