I am trying to setup a function to generate a Quote document from the information provided by a Deal document. However I can not seem to figure out how to format the map for the product details properly.
{"code":"MANDATORY_NOT_FOUND","details":{"api_name":"product","index":0,"parent_api_name":"Product_Details"},"message":"required field not found","status":"error"}
deal_map = zoho.crm.getRecordById("Deals",deal_id);
//create map of deal details
Subject_Name = zoho.currentdate + "_" + deal_map.get("Deal_Number");
info deal_map;
product_details = deal_map.get("Lookup_3");
// retrieve product item from deal
product_final = list:map();
product_list = product_details.toJSONList();
product_id = product_details.get("id");
product_map = map();
product_list.add({ "Product Id" : product_id, "Unit Price" : deal_map.get("Customer_Cost_Per_Haul"), "Quantity" : Quantity, "Total" : deal_map.get("Customer_Cost_Per_Haul")
*Quantity });
contract_map = Map();
//create map of details to move into the contract module from deal map
contract_map.put("Subject",Subject_Name);
contract_map.put("Deal_Name",deal_map.get("Deal_Name"));
contract_map.put("Contact_Name",deal_map.get("Contact_Name"));
contract_map.put("Account_Name",deal_map.get("Account_Name"));
contract_map.put("Service_Date",deal_map.get("Initial_Service_Date"));
contract_map.put("Owner",deal_map.get("Owner"));
contract_map.put("Product_Details", product_list);
contract_map.put("Shipping_Street",deal_map.get("Street_Address"));
contract_map.put("Tonnage_Included1",deal_map.get("Single_Line_8"));
contract_map.put("Tonnage_Overage",deal_map.get("Tonnage_Overage_Price"));
contract_map.put("Rental_Days_Included1",deal_map.get("Rental_Days_Included"));
contract_map.put("Per_Day_Overage1",deal_map.get("Per_Day_Overage"));
contract_map.put("Rental_Overage_Per",deal_map.get("Rental_Per_Days"));
contract_map.put("Additional_Details",deal_map.get("Additional_Details"));
contract_map.put("Notes1",deal_map.get("Other_Notes"));
// info contract_map;
create_contract = zoho.crm.createRecord("Quotes",contract_map);
return create_contract;