1

I am trying to build a simple application in Zoho Creator where a person inputs the data of a sales order. This has to be translated into Zoho Books along with the integration of the manual orders sent via Zoho Books.

I have done every single step mentioned in this link: https://github.com/TheWorkflowAcademy/Zoho-Books-Custom-Connections

Plus whatever Zoho is telling here: https://help.zoho.com/portal/en/community/topic/integreat-03-integrating-zoho-creator-with-zoho-books

Here is my code:

listVar = List();

//iterating each row in the subform
for each line in Items_to_Order
{
  mapVar = map();
  mapVar.put("item_id", line.Item_ID);
  mapVar.put("name", line.Item_Name);
  mapVar.put("rate", line.Price);
  mapVar.put("quantity", line.Quantity);
  listVar.add(mapVar);
}

values = map();
values.put("customer_id", input.Sales_Order_ID);
values.put("line_items", listVar);
response = invokeurl
[
    url : "https://books.zoho.com/api/v3/salesorders?organization_id=762389459"
    type :POST
    parameters:mapVar
    connection:"zoho_books"
    detailed:true
];

// To see all headers and content
info response;
James Westgate
  • 11,306
  • 8
  • 61
  • 68

2 Answers2

1

Make sure you're passing the right values on your map, line.Item_ID must be the ID of your item on books, same for "customer_id". and check whether you have any other required parameter such as "Reference_number" if its automatically generated or not. If you're sure everithing is set correctly, can you just paste the response outcome?

1

I know I'm a little late to the party - but I notice that you're invoking the URL and passing [mapVar] for the parameters. Shouldn't you be passing [values]?

[mapVar] is your temporary map for each line item that you're adding to [listVar] list. You then create a new map [values] and add [listVar] to it as 'list_items'.

It looks like you built everything right, but when you invokeUrl, you're only passing the original [mapVar] (a single line item) instead of [values]

carbonisle
  • 51
  • 6