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?
- for each custom_fields in verCustomFields
- {
- if(custom_fields.getJSON("customfield_id") == "81921000002217437")
- {
- lineas = salesorder.getJSON("line_items");
- for each lineItem in lineas
- {
- info lineItem;
- lineId = lineItem.get("line_item_id");
- data = {"line_item_id":lineId,"tax_id":"81921000001582013"};
- newlist = List();
- newlist.add("data");
- tata = Map();
- tata.put("line_items",newlist);
- json = Map();
- json.put("JSONString",data);
- info json;
- update = invokeurl
- [
- url :"https://books.zoho.eu/api/v3/salesorders/" + salesorderID + "?organization_id=" + organizationID + "&authtoken=" + authtoken
- type :PUT
- parameters:json
- ];
- info update;
- }
- }
- }