hello, i have a issue when i was create Quote from Deals using script in below
Return_Map = Map();
Error_Map = Map();
Quote_Products_List = list();
Create_Quote_Map = Map();
info "CRETATE QUOTE MAP" + Create_Quote_Map;
info Quote_Products_List;
Pipeline_Record = zoho.crm.getRecordById("Deals",Pipeline_ID);
//Dest_Record = zoho.crm.getRecordById("Quotes",Quote_ID);
Products_and_Services = Pipeline_Record.getJSON("Product_Detail");
if(Products_and_Services != null)
{
for each Product_or_Service in Products_and_Services
{
Product_Mini_Record = Product_or_Service.getJSON("Product_Type");
if(Product_Mini_Record != null)
{
Product_ID = Product_Mini_Record.getJSON("id");
//
Product_Map = Map();
Product_Map.put("product",Product_ID);
// Set Product Qty to 1 if Empty or 0
if(Product_or_Service.getJSON("Quantity") == 0 || Product_or_Service.getJSON("Quantity") == null)
{
Product_Quantity = 1;
}
else
{
Product_Quantity = Product_or_Service.getJSON("Quantity");
}
//
Product_Map.put("quantity",Product_Quantity);
Product_Map.put("Product_Name",ifnull(Product_or_Service.getJSON("Product_Name"),""));
Product_Map.put("Unit_Price",Product_or_Service.getJSON("Unit_Price"));
Product_Map.put("Duration",Product_or_Service.getJSON("Duration"));
Product_Map.put("Price_Total",ifnull(Product_or_Service.getJSON("Product_Total"),""));
//
//
//
//ADD the Quote Product Map to the Quote Product List
Quote_Products_List.add(Product_Map);
info Product_Map;
info "MINI RECORD" + Product_Mini_Record;
info Products_and_Services;
}
}
}
Pipeline_Name = Pipeline_Record.getJSON("Deal_Name");
Contact_Mini_Record = Pipeline_Record.getJSON("Contact_Name");
if(Contact_Mini_Record != null)
{
Contact_ID = Contact_Mini_Record.getJSON("id");
}
Account_Mini_Record = Pipeline_Record.getJSON("Account_Name");
if(Account_Mini_Record != null)
{
Account_ID = Account_Mini_Record.getJSON("id");
}
info "Nama Pipeline" + Pipeline_Name;
info Products_and_Services;
info Product_Mini_Record;
info "Data Check" + Quote_Products_List;
if(Quote_Products_List.isEmpty() == true)
{
info "Error - No Product Found";
Error_Map.put("No Product Found",Quote_Products_List);
}
else
{
//Create Found
Create_Quote_Map.put("Product_Details",Quote_Products_List);
Create_Quote_Map.put("Subject",Pipeline_Name);
Create_Quote_Map.put("Contact_Name",Contact_ID);
Create_Quote_Map.put("Account_Name",Account_ID);
Create_Quote_Map.put("Deal_Name",Pipeline_ID);
Create_Quote_Response = zoho.crm.createRecord("Quotes",Create_Quote_Map,{"trigger":{"button","workflow","blueprint","approval"}});
info "CHECK CREATE" + Create_Quote_Response;
info "DATAAA" + Create_Quote_Response;
info "DATA ID" + "" + Create_Quote_Response.containKey("id");
if(Create_Quote_Response != null)
{
if(Create_Quote_Response.containKey("id") == true)
{
info "QUOTE SUCCESSFULLY UPDATED";
Quote_Record_ID = Create_Quote_Response.getJSON("id");
Return_Map.put("SUCCESS","SUCCESS");
Return_Map.put("Quote_Record_ID",Quote_Record_ID);
}
}
}
if(Quote_Record_ID == null)
{
info "ERROR UPDATING QUOTE";
Error_Map.put("No Quote_Record_ID Found",Create_Quote_Response);
}
if(Error_Map.isEmpty() == false)
{
// ERROR
Return_Map.put("ERRORS",Error_Map);
}
return Return_Map;
the issue is Product_Name, Unit_Price and Duration not created and import to Quotes. Any suggestion for my issue