PipelineRecords = zoho.crm.getRecordById("Deals",Pipeline_ID);
//-------------------------------------------------------------------------
//Get PCE ID from pipeline related list
PCEList = zoho.crm.getRelatedRecords("PCE","Deals",Pipeline_ID);
PCERecords = PCEList.get(0);
PCE_ID = PCERecords.get("id").toLong();
//-------------------------------------------------------------------------
//Get Subform Project Cost Estimation
GetPCE = zoho.crm.getRecordById("PCE",PCE_ID);
PCESubForm = GetPCE.get("Project_Cost_Estimation");
PCESubFormSize = GetPCE.get("Project_Cost_Estimation").size();
lastRow = PCESubFormSize - 1;
ProjectCostList = list();
//-------------------------------------------------------------------------
//Looping dari Subformnya PCE untuk di taruh di Parameter List
for each count in PCESubForm
{
//dapatin param yang ingin di tampilin di menu Detail
temporary = Collection();
temp_item = count.get("Component").get("name");
temp_percentage = count.get("Percentage");
temp_qty = count.get("Qty");
temp_qty = count.get("Qty");
temp_amount = count.get("CTC");
temp_total = count.get("Total_Price");
//insert to temporary collection
temporary.insert(temp_item);
temporary.insert(temp_percentage);
temporary.insert(temp_qty);
temporary.insert(temp_amount);
temporary.insert(temp_total);
//insert temporary collection to list
ProjectCostList.add(temporary);
}
//-------------------------------------------------------------------------
// Tampilin Data Dari Subform PCE
//buat header tabel project cost estimation
responseXML = "";
responseXML = responseXML + "<records>";
//-------------------------------------------------------------------------
// untuk menampilkan data dari subform PCE
rowNumber = 1;
for each ToDisplay in ProjectCostList
{
responseXML = responseXML + "<row no=\"" + rowNumber + "\">";
responseXML = responseXML + "<FL val=\"Items\">" + ToDisplay.get(0) + "</FL>";
responseXML = responseXML + "<FL val=\"Percentage\">" + ToDisplay.get(1) + "</FL>";
responseXML = responseXML + "<FL val=\"Qty\">" + ToDisplay.get(2) + "</FL>";
responseXML = responseXML + "<FL val=\"Amount\">" + ToDisplay.get(3) + "</FL>";
responseXML = responseXML + "<FL val=\"TotalPrice\">" + ToDisplay.get(4) + "</FL>";
responseXML = responseXML + "</row>";
rowNumber = rowNumber + 1;
}
//-------------------------------------------------------------------------
responseXML = responseXML + "</records>";
return responseXML;