Update Record In Zoho Inventory

Note:

  • Each time the zoho.inventory.updateRecord 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.updateRecord 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.updateRecord task updates the records from the specified module of Zoho Inventory.

Syntax

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

where:

 

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

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

Allowed Values:

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

The organization ID of the account in which the record needs to be updated.

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 updated.

Note: Learn how to fetch the ID of a record after creating it or fetching it.
<values_map>KEY-VALUEThe new values of the record that needs to be updated. 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

The following script updates the record - 478XXXXXXXXXXX009 in the Zoho Inventory module - Items with the specified values:

 new_values = Map();
 new_values.put("purchase_rate","850");
 response = zoho.inventory.updateRecord("Items", "58XXXX49",478XXXXXXXXXXX009, new_values);

where:

response
The KEY-VALUE response returned by Zoho Inventory. It represents the details of the record that will be updated.
"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 updated.
new_values
The KEY-VALUE variable that holds the new values of the record that needs to be updated.

Response Format

Success Response

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

      {
      "code": 0,
      "message": "Item details have been saved.",
      "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": 40,
      "request_handling_time": 1659,
      "response_write_time": 70,
      "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": 2006,
      "message": "This item cannot be edited as it does not exist."
      }
  • The failure response when an empty map is passed to the <values_map> parameter will be returned in the following format:

      {
      "code": 37,
      "message": "The HTTP method PUT is not allowed for the requested resource"
      }
  • The failure response returned for null value parameter will be returned in the following format:

      {
      "code": 3062,
      "message": "The customer \"Shawn\" already exists. Please specify a different name."
      }

Related Links