Update a Record in QuickBooks
Table of Contents
Overview
The intuit.quickbooks.update() task is used to update a record from any of the supported modules in your QuickBooks account, by specifying the unique ID of the record. For example, you can update a customer record from the Customer module in quickbooks with the given record ID. To connect Zoho CRM with QuickBooks, download and install the QuickBooks connector from the Zoho Marketplace .
Supported Modules
- Customer
- Vendor
- Item
- Invoice
- Account
- Employee
- Department
Syntax
<quickbooksResponse> = intuit.quickbooks.update("zoho_quickbooks", <quickbooksModuleName>,<quickbooksCompanyId> , <recordId>, <syncToken>, <paramValues>.);
where,
<quickbooksResponse> is the map variable returned by Quickbooks as response. It contains the details of the fetched record.<quickbooksModuleName> refers to the module name in Quick Books from where the record is fetched.
<quickbooksCompanyId> refers to the unique ID generated by Quickbooks for each account. Refer CompanyId for more information.
<recordId> is the ID in Quickbooks based on which the record related to the ID is fetched.
<synToken> is the version number of the unique record id.
<paramValues> is the map variable that holds the key value pairs of the attributes to be updated
Refer the Quickboks API Guide for the attributes to be specified for each module.
Example
A sample script to update a record from the Quickbooks customer module with a given record ID, is given below.
//get records with the specified criteria
searchResponse = intuit.quickbooks.searchRecords("zoho_quickbooks", "1241802285", "SELECT * FROM Customer where DisplayName ='Henry'");
queryResponse = ((getResponse).get("QueryResponse")).toMap();
queryResponseList = queryResponse.get("Customer").toJSONList();
for each x in queryResponseList
{
y = x.toMap();
id = y.get("Id");
synToken = y.get("SyncToken");
//get record by id
getIdResponse = intuit.quickbooks.getRecordById("zoho_quickbooks", "Customer", "1241802285", id);
//update
param = map();
param.put("FamilyName", "HenryPaul");
updateResponse = intuit.quickbooks.update("zoho_quickbooks", "Customer", "1241802285", id, synToken, param);
info updateResponse;
}
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.
{
“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-07T04:10:06-07:00"
}","Taxable":false,
"BillAddr":"{"Long":"-77.02225539999999",
"Line1":"450 7th StreetnWashington DC",
"Lat":"38.8958239",
"Id":"6"
}","domain":"QBO",
"SyncToken":"3",
"PrintOnCheckName":"Hudson",
"CurrencyRef":"{"name":"Indian Rupee",
"value":"INR"
}","Id":"5",
"FamilyName":"HenryPaul",
"Balance":0,
"sparse":false
}","time":"2014-08-07T04:10:06.520-07:00"
}
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"
}]"
}