"Invalid value passed for Product ID" Error in Zoho Flow "Create Sales Order" Node
Hello Zoho Community,
I’m facing an issue with Zoho Flow while trying to create a sales order in Zoho Inventory using the "Create Sales Order" node. Here’s a detailed explanation of my setup and the problem:
What I’m Trying to Achieve
I’m building an automation in Zoho Flow to create sales orders in Zoho Inventory based on orders received from an external platform. The process involves:
- Fetching items from Zoho Inventory using their SKU.
- Creating a sales order in Zoho Inventory with the fetched items.
My Setup
- I have a custom function (fetchItems) that fetches items from Zoho Inventory using the SKU via the Zoho Inventory API (/items endpoint). This function works perfectly and returns a list of items in the following format:
json
[
{
"item_id": "XXXX",
"quantity": 2,
"rate": 151.56,
"ean": "YYYY"
}
]
The item_id is fetched as a string from the API response and converted to a number using toLong() in some attempts (I’ve tried both string and number formats).
- I then use a decision node to check if the fetchItems output is not empty (fetchItems_1.itemsList.size() > 0), which passes successfully.
- Finally, I use the "Create Sales Order" node in Zoho Flow to create a sales order in Zoho Inventory. The node is configured as follows:
- Organization: Correct organization ID (verified).
- Connection: A Zoho Inventory connection with ZohoInventory.items.READ and ZohoInventory.salesorders.CREATE scopes.
- Customer ID, Sales Order Number, and Sales Order Date: Populated from the trigger.
- Items: I map the fetchItems_1.itemsList directly to the "Items" field using the "Insert Variable" option.
The Issue
The "Create Sales Order" node consistently fails with the error:
"Zoho Inventory says 'Invalid value passed for Product ID'"
What I’ve Tried
- Item ID Format:
- Initially, I kept the item_id as a string (as returned by the /items API).
- I also tried converting the item_id to a number using toLong() in the fetchItems function, but the error persists in both cases.
- Organization ID:
- I verified that the organization ID used in the fetchItems function (for fetching items) and the "Create Sales Order" node is the same.
- Connection:
- The connection used in the "Create Sales Order" node has the required scopes (ZohoInventory.items.READ and ZohoInventory.salesorders.CREATE).
- I re-authenticated the connection to ensure it’s up to date.
- Item Status:
- I checked the item in Zoho Inventory (via the UI) and confirmed that the item_id exists, the item is active, and it’s a sales item with available stock.
- Direct API Call:
- As a workaround, I tried creating the sales order directly via the Zoho Inventory API (/salesorders endpoint) using a POST request in a custom function. However, I’d prefer to use the "Create Sales Order" node for simplicity.
Questions
- Why is the "Create Sales Order" node rejecting the item_id even though it’s valid and exists in Zoho Inventory?
- Does the "Create Sales Order" node expect the item_id in a specific format (string or number)?
- Could there be an issue with the connection or scopes that I might have overlooked?
- Are there any specific item settings in Zoho Inventory that could prevent an item from being added to a sales order?
Any help or suggestions would be greatly appreciated! I can provide more details about my setup if needed (without sharing sensitive data).
Thank you,