We are attempting to use a Zoho Form as a trigger in a Zoho Flow to create an estimate in FSM. The estimate creation works when adding services to the estimate but the issue we are having is getting the Work Types to be recognized and the Part Line Items to be added.
For example: A customer makes a pool closing request in forms, the service is "Pool Closing" , the Work Type for "Pool Closing" is "Pool Closing Work Type". The "Pool Closing Work Type" includes Parts, which are "Antifreeze" (Qty. 3).
When the service "Pool Closing" is added to an estimate manually in FSM (Not through the forms) the Parts are automatically added to the estimate. When done through forms/flow, the parts are not added automatically.
This is our current flow (after access tokens, etc. which we know are working)
get_contact = invokeurl
[
type :GET
parameters:emptyMap
headers:create_header_map
];
contact_size = get_contact.get("data").size();
if(contact_size >= 1)
{
contact_email = get_contact.get("data").get(0).get("Email");
if(contact_email == email)
{
contact_id = get_contact.get("data").get(0).get("id");
Billing_Address_id = get_contact.get("data").get(0).get("Billing_Address").get("id");
Service_Address_id = get_contact.get("data").get(0).get("Service_Address").get("id");
allproducts = {{"id":pool_closing_request},{"id":pool_closing_cover_and_service},{"id":lower_water},{"id":filter_cleaning},{"id":filter_return},{"id":spa_or_swim_spa_closing},{"id":fountains_waterfalls},{"id":chemistry_automation_probes}};
part_list = list();
product_list = list();
for each product in allproducts
{
product_id = product.get("id").toString();
if(product_id != null)
{
info product_id;
product_id_found = product_id.isNumber();
if(product_id_found == true)
{
final_product_id = product_id.toNumber();
product_map = Map();
product_map.put("Service",final_product_id);
product_list.add(product_map);
get_Work_Type = invokeurl
[
type :GET
parameters:emptyMap
headers:create_header_map
];
Work_Type = get_Work_Type.get("data").get(0).get("Work_Type");
if(Work_Type != null)
{
info Work_Type;
Work_Type_id = Work_Type.get("id");
part_map = Map();
part_map.put("Part",Work_Type_id);
part_list.add(part_map);
}
}
}
}
// part_map2 = Map();
// part_map2.put("Part_Line_Items",part_ist);
// product_list.add(part_map2);
serviceAddress = Map();
serviceAddress.put("id",Service_Address_id);
billingAddress = Map();
billingAddress.put("id",Billing_Address_id);
newRecordInfo = Map();
newRecordInfo.put("Summary","PPCK 2024");
newRecordInfo.put("Status","New");
newRecordInfo.put("Email",contact_email);
newRecordInfo.put("Contact",contact_id);
newRecordInfo.put("Service_Line_Items",product_list);
newRecordInfo.put("Service_Line_Items",part_list);
newRecordInfo.put("Service_Address",serviceAddress);
newRecordInfo.put("Billing_Address",billingAddress);
create_map = Map();
create_map.put("data",{newRecordInfo});
info create_map;
create_estimate = invokeurl
[
type :POST
parameters:create_map.toString()
headers:create_header_map
];
info create_estimate;
}
}
}