Unable to change tax with custom function

Unable to change tax with custom function

Hi,

In the Global Edition, Zoho Books has not the feature of having taxes related to customers, so I was trying to do a custom function to do so. The idea is to create a custom field in the client and when the sales order is created, check that custom field and change the taxes of all the items in the sales order.

The problem I am encountering is that when I try to change the tax_id to the new one tax, I always get this error

{"code":8,"message":"tax_id element not valid"}

This is part of my code. Any ideas of what I am doing wrong?


  1. for each  custom_fields in verCustomFields
  2. {
  3. if(custom_fields.getJSON("customfield_id") == "81921000002217437")
  4. {
  5. lineas = salesorder.getJSON("line_items");
  6. for each  lineItem in lineas
  7. {
  8. info lineItem;
  9. lineId = lineItem.get("line_item_id");
  10. data = {"line_item_id":lineId,"tax_id":"81921000001582013"};
  11. newlist = List();
  12. newlist.add("data");
  13. tata = Map();
  14. tata.put("line_items",newlist);
  15. json = Map();
  16. json.put("JSONString",data);
  17. info json;
  18. update = invokeurl
  19. [
  20. url :"https://books.zoho.eu/api/v3/salesorders/" + salesorderID + "?organization_id=" + organizationID + "&authtoken=" + authtoken
  21. type :PUT
  22. parameters:json
  23. ];
  24. info update;
  25. }
  26. }
  27. }