Get Records By ID From Zoho Inventory

Note:

  • Each time the zoho.inventory.getRecordsByID 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.getRecordsByID 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.getRecordsByID task fetches a record from the specified module of Zoho Inventory using its ID.

Syntax

<response> = zoho.inventory.getRecordsByID(<module>, <org_id>, <record_id>, [<connection>]);

where:

 

ParamsData typeDescription
<response>KEY-VALUEThe details of the record that will be fetched.
<module>TEXT

The module in which the record that needs to be fetched is held.

Allowed Values:

  • Contacts
  • PurchaseOrders
  • Bills
  • SalesOrders
  • CompositeItems
  • Items
  • Invoices
  • Packages (not supported in Zoho Creator)
  • ShipmentOrders (not supported in Zoho Creator)
<org_id>TEXT

The organization ID of the account from which the record needs to be fetched.

Note: Learn how to fetch organization ID from the UI and from the response of zoho.inventory.getOrganization task.
<record_id>TEXT

The ID of the record that needs to be fetched.

Note: Learn how to fetch the ID of a record after creating it or fetching it.

<connection>

(optional)

TEXT

The name of the connection.

Note: This parameter is not applicable to Zoho Creator and mandatory in Zoho Cliq.

Example 1

The following script fetches the record with ID - 478XXXXXXXXXXX009 from the Zoho Inventory module - Items:

 response = zoho.inventory.getRecordsByID("Items", "58XXXX49", "478XXXXXXXXXXX009");

where:

response
The KEY-VALUE response returned by Zoho Inventory. It represents the details of the record that will be fetched.
"Items"
The TEXT that represents the name of the module.
"58XXXX49"
The TEXT that represents the organization ID.
"478XXXXXXXXXXX009"
The TEXT that represents the ID of the record that needs to be fetched.

Response Format

Success Response

  • The success response will be returned in the following format:

      {
      "code": 0,
      "message": "success",
      "item": {
      "item_id": "478XXXXXXXXXXX009",
      "name": "Earphones",
      "unit": "pcs",
      "brand": "",
      "manufacturer": "",
      "is_linked_with_zohocrm": false,
      "zcrm_product_id": "",
      "crm_owner_id": "",
      "tax_id": "",
      "documents": [
      ],
      "description": "",
      "tax_name": "",
      "tax_percentage": 0,
      "tax_type": "",
      "product_type": "goods",
      "category_id": "",
      "category_name": "",
      "purchase_account_id": "478XXXXXXXXXXX003",
      "purchase_account_name": "Cost of Goods Sold",
      "account_id": "478XXXXXXXXXXX388",
      "account_name": "Sales",
      "inventory_account_id": "478XXXXXXXXXXX001",
      "inventory_account_name": "Inventory Asset",
      "status": "active",
      "source": "user",
      "is_combo_product": false,
      "item_type": "inventory",
      "is_returnable": true,
      "rate": 800.0,
      "pricebook_rate": 800.0,
      "purchase_rate": 850.0,
      "reorder_level": "",
      "initial_stock": 0.0,
      "initial_stock_rate": 0.0,
      "vendor_id": "",
      "vendor_name": "",
      "stock_on_hand": 0.0,
      "asset_value": "",
      "available_stock": 0.0,
      "actual_available_stock": 0.0,
      "committed_stock": 0,
      "actual_committed_stock": 0.0,
      "available_for_sale_stock": 0.0,
      "actual_available_for_sale_stock": 0.0,
      "sku": "20",
      "upc": "",
      "ean": "",
      "isbn": "",
      "part_number": "",
      "image_document_id": "",
      "image_name": "",
      "custom_fields": [
      ],
      "custom_field_hash": {
      },
      "purchase_description": "",
      "image_type": "",
      "sales_channels": [
      ],
      "package_details": {
      "length": "",
      "width": "",
      "height": "",
      "weight": "",
      "weight_unit": "kg",
      "dimension_unit": "cm"
      },
      "preferred_vendors": [
      ]
      },
      "instrumentation": {
      "query_execution_time": 89,
      "request_handling_time": 64,
      "response_write_time": 193,
      "page_context_write_time": 0
      }
      }
      }

Failure Response

  • The failure response for incorrect or non-existent record ID will be returned in the following format:

      {
      "code": 1002,
      "message": "Sorry! The item you are looking for is not available!"
      }
  • 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:5831949."
      }

Related Links