Updating Products In a Sales Order

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:
  1. void salesorderupdateprojectstatus(string SalesOrder_ID, string Project_ID)
  2. {
  3. info "Sales Order ID " + SalesOrder_ID;
  4. info "Project Order ID " + Project_ID;
  5. SalesOrder = zoho.books.getRecordsByID("salesorders","XXXXXXX",SalesOrder_ID,"zohobooksconnection");
  6. SalesOrderJSON = SalesOrder.toJSONList();
  7. // info SalesOrderJSON;
  8. ProductList = SalesOrderJSON.getJSON("salesorder").getJSON("line_items");
  9. // info ProductList;
  10. projectmap = Map();
  11. projectmap.put("project_id",Project_ID);
  12. lineitemmap = Map();
  13. lineitemmap.put("line_items",projectmap);
  14. salesordermap = Map();
  15. salesordermap.put("salesorder",lineitemmap);
  16. for each  item in ProductList
  17. {
  18. SalesOrderUpdate = zoho.books.updateRecord("salesorders","XXXXXXX",SalesOrder_ID,salesordermap,"zohobooksconnection");
  19. }
  20. info SalesOrderUpdate;
  21. }
But this does not seem to update. Any one know why this isnt working?

Thanks for any help