Create a record in QuickBooks
Table of Contents
Overview
The intuit.quickbooks.create() task is used to add a record in any of the supported modules of your QuickBooks account, directly from your Zoho CRM. For example, you can add a new customer, create a new invoice for a specific customer or add a new vendor in quickbooks. 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.create("zoho_quickbooks",<quickbooksModuleName>,<quickbooks CompanyId> , <params>);
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.
<params> is the map variable that holds the key,value pairs. The map key is the label name in the format as specified in QuickBooks API.
Refer the Quickboks API Guide for the attributes to be specified for each module.
Example - To create a record
A sample script to add a customer to the Quickbooks customer module is given below.
//Declare Map Variable to hold the customer details
Customer_Details = map();
//Add the customer details to the map variable
Customer_Details.put("FamilyName", "George Stepenson");
Customer_Details.put("FullyQualifiedName", "Stepenson ");
Customer_Details.put("DisplayName", "George");
//declare map variable to hold the shipping address
Shipping_Address = map();
//add shipping address to the map variable
Shipping_Address.put("Line1", "312, 10th Avenue");
Shipping_Address.put("Line2", "Rick cross street");
Shipping_Address.put("Line3", "5th Block");
Shipping_Address.put("Country", "USA");
//declare map variable to hold the billing address
Billing_Address = map();
//add billing address to the map variable
Billing_Address.put("Line1", "312, 10th Avenue");
Billing_Address.put("Line2", "Rick cross street");
Billing_Address.put("Line3", "5th Block");
Billing_Address.put("Country", "USA");
//adding the shipping address to customer details
Customer_Details.put("ShipAddr", Shipping_Address);
//adding the billing address to customer details
Customer_Details.put("BillAddr", Billing_Address);
//creating the customer in the Quickbooks Customer module with connecton name "Zoho" and company id "1241802285"
createResponse = intuit.quickbooks.create("zoho_quickbooks", "Customer", "1241802285", Customer_Details);
Example - To get the ID of the created record
createResponse = createResponse.get("Customer");
id = createResponse.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.
- In the above example, we have specified the param values directly within quotes. To fetch the param values from a Zoho CRM, specify the field name used in Zoho CRM. For example, if Family_Name is the Field Deluge name, the key value pair should be specified in the following format: ("FamilyName", Family_Name)
Response Format
The response returned by Quickbooks will be in the format given below.
{
"Customer":"{" ShipAddr":"{" Line3":"5th Block",
"Long":"-121.8773403",
"Line2":"Rick cross street",
"Line1":"312, 10th Avenue",
"Lat":"37.3357731",
"Id":"13",
"Country":"USA"
}","PreferredDeliveryMethod":"Email",
"BalanceWithJobs":0,
"DisplayName":"George",
"FullyQualifiedName":"George",
"BillWithParent":false,
"Job":false,
"Active":true,
"MetaData":"{"CreateTime":"2014-08-06T03:19:41-07:00",
"LastUpdatedTime":"2014-08-06T03:19:41-07:00"
}","Taxable":false,
"BillAddr":"{"Line3":"5th Block",
"Long":"-121.8773403",
"Line2":"Rick cross street",
"Line1":"312, 10th Avenue",
"Lat":"37.3357731",
"Id":"12",
"Country":"USA"
}","domain":"QBO",
"SyncToken":"0",
"PrintOnCheckName":"George Stepenson",
"CurrencyRef":"{"name":"Indian Rupee",
"value":"INR"
}","Id":"8",
"FamilyName":"George Stepenson",
"Balance":0,
"sparse":false
}","time":"2014-08-06T03:19:41.084-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"
}]"
}
Note
- The key-value pairs displayed will differ based on the module selected.