Create Record in Zoho Inventory
Table of Contents
Note:
- Each time the zoho.inventory.createRecord integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
- Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.inventory.createRecord integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script.
Description
The zoho.inventory.createRecord task creates a record in the specified module of Zoho Inventory.
Syntax
<response> = zoho.inventory.createRecord(<module>, <org_id>, <data_map>, [<connection>]);
where:
| Params | Data type | Description |
| <response> | KEY-VALUE | The details of the record that will be created in the specified module. |
| <module> | TEXT | The module in which the record that needs to be fetched is held. Allowed Values:
|
| <org_id> | TEXT | The organization ID of the account in which the record needs to be created. Note: Learn how to fetch organization ID from the UI and from the response of zoho.inventory.getOrganization task. |
| <data_map> | KEY-VALUE | The values of the new record that needs to be created. The keys to this parameter are provided as specified in Zoho Inventory API. |
<connection> (optional) | TEXT | The name of the connection. Note: This parameter is not applicable to Zoho Creator and mandatory in Zoho Cliq. |
Example
The following script creates a record with the specified values in the Zoho Inventory module - Contacts:
record_value = Map(); record_value.put("contact_name","Shawn"); response = zoho.inventory.createRecord("Contacts", "58XXXX49", record_value);
where:
response"Contacts""58XXXX49"record_valueResponse Format
Success Response
The success response will be returned in the following format:
{
"code": 0,
"message": "The contact has been added.",
"contact": {
"contact_id": "478XXXXXXXXXXX001",
"contact_name": "Shawn",
"company_name": "",
"first_name": "",
"last_name": "",
"designation": "",
"department": "",
"website": "",
"language_code": "",
"language_code_formatted": "",
"contact_salutation": "",
"email": "",
"phone": "",
"mobile": "",
"portal_status": "disabled",
"is_client_review_asked": false,
"has_transaction": false,
"contact_type": "customer",
"customer_sub_type": "business",
"owner_id": "",
"owner_name": "",
"source": "api",
"documents": [
],
"twitter": "",
"facebook": "",
"is_crm_customer": false,
"is_linked_with_zohocrm": false,
"primary_contact_id": "",
"zcrm_account_id": "",
"zcrm_contact_id": "",
"crm_owner_id": "",
"payment_terms": 0,
"payment_terms_label": "Due On Receipt",
"credit_limit_exceeded_amount": 0.0,
"currency_id": "478XXXXXXXXXXX099",
"currency_code": "INR",
"currency_symbol": "Rs.",
"price_precision": 2,
"exchange_rate": "",
"can_show_customer_ob": true,
"can_show_vendor_ob": true,
"opening_balance_amount": 0.0,
"opening_balance_amount_bcy": "",
"outstanding_ob_receivable_amount": 0.0,
"outstanding_ob_payable_amount": 0.0,
"outstanding_receivable_amount": 0.0,
"outstanding_receivable_amount_bcy": 0.0,
"outstanding_payable_amount": 0.0,
"outstanding_payable_amount_bcy": 0.0,
"unused_credits_receivable_amount": 0.0,
"unused_credits_receivable_amount_bcy": 0.0,
"unused_credits_payable_amount": 0.0,
"unused_credits_payable_amount_bcy": 0.0,
"unused_retainer_payments": 0.0,
"status": "active",
"payment_reminder_enabled": true,
"is_sms_enabled": true,
"is_client_review_settings_enabled": false,
"custom_fields": [
],
"custom_field_hash": {
},
"contact_category": "",
"sales_channel": "direct_sales",
"ach_supported": false,
"billing_address": {
"address_id": "478XXXXXXXXXXX003",
"attention": "",
"address": "",
"street2": "",
"city": "",
"state_code": "",
"state": "",
"zip": "",
"country": "",
"phone": "",
"fax": ""
},
"shipping_address": {
"address_id": "478XXXXXXXXXXX005",
"attention": "",
"address": "",
"street2": "",
"city": "",
"state_code": "",
"state": "",
"zip": "",
"country": "",
"phone": "",
"fax": ""
},
"contact_persons": [
],
"addresses": [
],
"pricebook_id": "",
"pricebook_name": "",
"default_templates": {
"invoice_template_id": "",
"invoice_template_name": "",
"bill_template_id": "",
"bill_template_name": "",
"estimate_template_id": "",
"estimate_template_name": "",
"creditnote_template_id": "",
"creditnote_template_name": "",
"purchaseorder_template_id": "",
"purchaseorder_template_name": "",
"salesorder_template_id": "",
"salesorder_template_name": "",
"paymentthankyou_template_id": "",
"paymentthankyou_template_name": "",
"invoice_email_template_id": "",
"invoice_email_template_name": "",
"estimate_email_template_id": "",
"estimate_email_template_name": "",
"creditnote_email_template_id": "",
"creditnote_email_template_name": "",
"purchaseorder_email_template_id": "",
"purchaseorder_email_template_name": "",
"salesorder_email_template_id": "",
"salesorder_email_template_name": "",
"paymentthankyou_email_template_id": "",
"paymentthankyou_email_template_name": "",
"payment_remittance_email_template_id": "",
"payment_remittance_email_template_name": ""
},
"associated_with_square": false,
"cards": [
],
"checks": [
],
"bank_accounts": [
],
"vpa_list": [
],
"notes": "",
"created_time": "2019-08-29T15:51:04+0530",
"last_modified_time": "2019-08-29T15:51:04+0530",
"tags": [
],
"zohopeople_client_id": ""
},
"instrumentation": {
"query_execution_time": 59,
"request_handling_time": 1049,
"response_write_time": 82,
"page_context_write_time": 0
}
}
To get the ID of the newly created record, execute the following script:
// example for <module_name> is contact and example for <module_name>_id is contact_id
Failure Response
The failure response for incorrect organization ID will be returned in the following format:
{
"code": 6041,
"message": "This user is not associated with the CompanyID/CompanyName: 58XXXX50."
}The failure response for missing mandatory parameter will be returned in the following format:
{
"code": 11,
"message": "The parameter JSONString is mandatory."
}The failure response for duplicate values will be returned in the following format:
{
"code": 3062,
"message": "The customer \"Shawn\" already exists. Please specify a different name."
}