Updating Products In a Sales Order
I am trying to using Zoho flow to create an automation to update all products on a sales order with a predefined project_id.
My inputs to the customer function is Sales order ID and Project ID.
My code is this:
- void salesorderupdateprojectstatus(string SalesOrder_ID, string Project_ID)
- {
- info "Sales Order ID " + SalesOrder_ID;
- info "Project Order ID " + Project_ID;
- SalesOrder = zoho.books.getRecordsByID("salesorders","XXXXXXX",SalesOrder_ID,"zohobooksconnection");
- SalesOrderJSON = SalesOrder.toJSONList();
- // info SalesOrderJSON;
- ProductList = SalesOrderJSON.getJSON("salesorder").getJSON("line_items");
- // info ProductList;
- projectmap = Map();
- projectmap.put("project_id",Project_ID);
- lineitemmap = Map();
- lineitemmap.put("line_items",projectmap);
- salesordermap = Map();
- salesordermap.put("salesorder",lineitemmap);
- for each item in ProductList
- {
- SalesOrderUpdate = zoho.books.updateRecord("salesorders","XXXXXXX",SalesOrder_ID,salesordermap,"zohobooksconnection");
- }
- info SalesOrderUpdate;
- }
But this does not seem to update. Any one know why this isnt working?
Thanks for any help