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:
- 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:
- void createWorkOrderWithServiceOnly()
- {
- // Dummy IDs
- contactId = "2373000000232155";
- territoryId = "2373000000205267";
- serviceAddrId = "2373000000232160";
- billingAddrId = "2373000000232159";
- serviceId = "27745000000369407";
- // === Work Order Map ===
- woMap = Map();
- woMap.put("Summary","Remodeling of the Crawford House");
- woMap.put("Type","Service");
- woMap.put("Contact",contactId);
- woMap.put("Company",null);
- woMap.put("Territory",territoryId);
- woMap.put("Service_Address",{"id":serviceAddrId});
- woMap.put("Billing_Address",{"id":billingAddrId});
- // === Service Line Item (mandatory) ===
- serviceLine = Map();
- serviceLine.put("Service",serviceId);
- serviceLine.put("Type","Service");
- serviceLine.put("Quantity",1);
- serviceLine.put("Sequence",1);
- serviceLines = List();
- serviceLines.add(serviceLine);
- woMap.put("Service_Line_Items",serviceLines);
- // === Add Config with Tax ===
- taxDetails = Map();
- taxDetails.put("Tax_Name","VAT");
- taxDetails.put("Tax_Percentage",10);
- woMap.put("Config",{"Tax_Details":taxDetails});
- // === Wrap in data[] ===
- finalPayload = Map();
- dataList = List();
- dataList.add(woMap);
- finalPayload.put("data",dataList);
- info finalPayload;
- // === Create Work Order ===
- woResp = zoho.fsm.createRecord("Work_Orders",finalPayload);
- info "Work Order Response: " + woResp;
- }
Question:
Even though I am passing Service_Line_Items with the Service, FSM still says the mandatory field is missing.
Would appreciate an example deluge for creating a simple Work Order with just few Service Line Item.
Thanks!