Get Records From Zoho Inventory
Table of Contents
Note:
- Each time the zoho.inventory.getRecords 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.getRecords 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.getRecords task fetches the records from the specified module of Zoho Inventory.
Syntax
<response> = zoho.inventory.getRecords(<module>, <org_id>, [<criteria_map>], [<connection>]);
where:
| Params | Data type | Description |
| <response> | KEY-VALUE | The details of the list of all the records that will be fetched from the specified Zoho Inventory module. |
| <module> | TEXT | The module from which the records need to be fetched. Allowed Values:
|
| <org_id> | TEXT | The organization ID of the account from which the records need to be fetched. Note: Learn how to fetch organization ID from the UI and from the response of zoho.inventory.getOrganization task. |
<criteria_map> (optional) | KEY-VALUE | The search criteria. The keys to this parameter are provided as specified in the 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 1: Fetch all records from the specified module
The following script fetches all the records from the Zoho Inventory module - Invoice:
response = zoho.inventory.getRecords("invoices", "58XXXX49");
where:
response"invoice""58XXXX49"Example 2: Fetch all the records that satisfy the specified criteria
The following script fetches the records from the Zoho Inventory module - Invoices that have the value - Kate in the field - customer_name:
query_param = Map(); query_param.put("customer_name", "Kate"); response = zoho.inventory.getRecords("invoices", "58XXXX49", query_param);
where:
query_paramResponse Format
Success Response
The success response will be returned in the following format:
{
"code":0,
"message":"success",
"invoices":
[
{
"invoice_id":"4787XXXXXXXXX9051",
"ach_payment_initiated":false,
"zcrm_potential_id":"",
"zcrm_potential_name":"",
"customer_name":"Kate",
"customer_id":"4787XXXXXXXXX8022",
"company_name":"",
"status":"draft",
"color_code":"",
"current_sub_status_id":"",
"current_sub_status":"draft",
"invoice_number":"INV-000002",
"reference_number":"",
"date":"2019-08-29",
"due_date":"2019-08-29",
"due_days":"",
"currency_id":"4787XXXXXXXXX0099",
"schedule_time":"",
"currency_code":"INR",
"is_pre_gst":false,
"tax_source":"",
"template_type":"",
"no_of_copies":1,
"show_no_of_copies":true,
"is_viewed_by_client":false,
"has_attachment":false,
"client_viewed_time":"",
"type":"invoice",
"project_name":"",
"total":1850.0,
"balance":1850.0,
"created_time":"2019-08-29T17:15:03+0530",
"last_modified_time":"2019-08-29T17:15:03+0530",
"is_emailed":false,
"reminders_sent":0,
"last_reminder_sent_date":"",
"payment_expected_date":"",
"last_payment_date":"",
"custom_fields":[],
"custom_field_hash":{},
"template_id":"",
"documents":"",
"salesperson_id":"",
"salesperson_name":"",
"shipping_charge":0.0,
"adjustment":0.0,
"write_off_amount":0.0,
"exchange_rate":0.0
},
{
"invoice_id":"4787XXXXXXXXX9018",
"ach_payment_initiated":false,
"zcrm_potential_id":"",
"zcrm_potential_name":"",
"customer_name":"Shawn",
"customer_id":"4787XXXXXXXXX8001",
"company_name":"",
"status":"draft",
"color_code":"",
"current_sub_status_id":"",
"current_sub_status":"draft",
"invoice_number":"INV-000001",
"reference_number":"",
"date":"2019-08-29",
"due_date":"2019-08-29",
"due_days":"",
"currency_id":"4787XXXXXXXXX0099",
"schedule_time":"",
"currency_code":"INR",
"is_pre_gst":false,
"tax_source":"",
"template_type":"",
"no_of_copies":1,
"show_no_of_copies":true,
"is_viewed_by_client":false,
"has_attachment":false,
"client_viewed_time":"",
"type":"invoice",
"project_name":"",
"total":1550.0,
"balance":1550.0,
"created_time":"2019-08-29T17:11:13+0530",
"last_modified_time":"2019-08-29T17:11:13+0530",
"is_emailed":false,
"reminders_sent":0,
"last_reminder_sent_date":"",
"payment_expected_date":"",
"last_payment_date":"",
"custom_fields":[],
"custom_field_hash":{},
"template_id":"",
"documents":"",
"salesperson_id":"",
"salesperson_name":"",
"shipping_charge":0.0,
"adjustment":0.0,
"write_off_amount":0.0,
"exchange_rate":0.0
}
],
"page_context":
{"page":1,
"per_page":200,
"has_more_page":false,
"report_name":"Invoices",
"applied_filter":"Status.All",
"sort_column":"created_time",
"sort_order":"D"
},
"instrumentation":
{"query_execution_time":116,
"request_handling_time":530,
"response_write_time":170,
"page_context_write_time":1
}
}
To fetch the IDs of the records, execute the following snippet:
// example for <module_name> is invoices
for each var1 in var
{
info var1.get("<module_name>_id");
// example for <module_name>_id is invoice_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."
}