Create record

Create record in Quickbooks

Overview

Create a record in Quickbooks using this task. 

Note: This task is applicable only to Zoho Creator.

Syntax

<variable> = intuit.quickbooks.create(<quickbooks_connection>, <quickbooks_module><company_ID>, <data_map>);

where,

ParameterDescriptionData type

<variable> 

is the variable which will hold the response returned by Quickbooks.

KEY-VALUE

<quickbooks_connection> 

is the name of the Quickbooks connection.

TEXT

<quickbooks_module>

is the name of the module in Quickbooks where the record will be added.

Following are the names of applicable modules.

Customer

    Item

Vendor

Invoice
AccountEmployee   Department
TEXT
<company_ID>

refers to the unique ID generated by Quickbooks for each account.

You can find this under Settings Icon -> Your Company -> Your Account in your Quickbooks account.

TEXT
<data_map>

Map with key as Quickbooks field's name and the required value. For ex: {"FamilyName":input.Name}

To learn about the mandatory fields, click here and navigate to the required module on that page.

KEY-VALUE

Example

The following snippet when executed creates a record with the specified values in the "Customer" module in Quickbooks. 

Customer_Details = map();
Customer_Details.put("FamilyName", "George Stepenson");
Customer_Details.put("FullyQualifiedName", "Stepenson ");
Customer_Details.put("DisplayName", "George");

Shipping_Address = map();
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");

Billing_Address = map();
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");

Customer_Details.put("ShipAddr", Shipping_Address);
Customer_Details.put("BillAddr", Billing_Address);

response = intuit.quickbooks.create("Quickbooks", "Customer", "1241802285", Customer_Details);

where,

ParameterDescription
Customer_Details
Shipping_Address
Billing_Address
are map variables which hold key value pairs
"ShipAddr"
"BillAddr"
are keys which hold key-value pairs(map variables Shipping_Address and Billing_Address) as values
Customer_Detailsis the map variable which holds key value pairs, where keys are the Quickbooks fields names along with their specified values.
"Quickbooks"is the name of the Quickbooks Connection
"Customer"is the module in Quickbooks, where the record will be created
"1241802285"is the company ID of the account in which the record will be created
responseis response returned as map by Quickbooks

Sample Response

Following is a sample success response returned by Quickbooks:

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

To get the ID of the newly created record, execute the following script:

<variable> = <response_variable>.get("<module_name>").get("Id");
​// use "SyncToken" instead of "Id" to fetch the SyncToken value

The failure response returned, due to incorrect parameter value, is of the following format:

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

Related Links

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com