Getting “mandatory field missing: Service_Line_Items” When Creating Work Order via Zoho Flow Deluge

Getting “mandatory field missing: Service_Line_Items” When Creating Work Order via Zoho Flow Deluge

Hi Team,

I’m trying to create a Work Order in Zoho FSM with only a Service Line Item (no Parts). However, I keep getting this error:

  1. Work Order Response: {"code":"MANDATORY_NOT_FOUND","details":{"api_name":"Service_Line_Items"},"message":"required field missing","status":"error"}
Here’s the code I’m using:
  1. void createWorkOrderWithServiceOnly()
  2. {
  3.     // Dummy IDs
  4.     contactId = "2373000000232155";
  5.     territoryId = "2373000000205267";
  6.     serviceAddrId = "2373000000232160";
  7.     billingAddrId = "2373000000232159";
  8.     serviceId = "27745000000369407";

  9.     // === Work Order Map ===
  10.     woMap = Map();
  11.     woMap.put("Summary","Remodeling of the Crawford House");
  12.     woMap.put("Type","Service");
  13.     woMap.put("Contact",contactId);
  14.     woMap.put("Company",null);
  15.     woMap.put("Territory",territoryId);
  16.     woMap.put("Service_Address",{"id":serviceAddrId});
  17.     woMap.put("Billing_Address",{"id":billingAddrId});

  18.     // === Service Line Item (mandatory) ===
  19.     serviceLine = Map();
  20.     serviceLine.put("Service",serviceId);
  21.     serviceLine.put("Type","Service");
  22.     serviceLine.put("Quantity",1);
  23.     serviceLine.put("Sequence",1);
  24.     serviceLines = List();
  25.     serviceLines.add(serviceLine);
  26.     woMap.put("Service_Line_Items",serviceLines);

  27.     // === Add Config with Tax ===
  28.     taxDetails = Map();
  29.     taxDetails.put("Tax_Name","VAT");
  30.     taxDetails.put("Tax_Percentage",10);
  31.     woMap.put("Config",{"Tax_Details":taxDetails});

  32.     // === Wrap in data[] ===
  33.     finalPayload = Map();
  34.     dataList = List();
  35.     dataList.add(woMap);
  36.     finalPayload.put("data",dataList);
  37.     info finalPayload;

  38.     // === Create Work Order ===
  39.     woResp = zoho.fsm.createRecord("Work_Orders",finalPayload);
  40.     info "Work Order Response: " + woResp;
  41. }

Question:
Even though I am passing Service_Line_Items  with the Service, FSM still says the mandatory field is missing.

  • What is the correct way to structure Service_Line_Items in Deluge?

  • Do I need to pass additional fields?

Would appreciate an example deluge for creating a simple Work Order with just few Service Line Item.

Thanks!