-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLabor-board-subform-population
29 lines (29 loc) · 1.03 KB
/
Labor-board-subform-population
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
fp_invoice_resp = zoho.crm.getRecordById("FP_Invoice",1915689000061412194);
invoiced_contractor = fp_invoice_resp.get("Contractor_id");
invoiced_this_week = fp_invoice_resp.get("Subform_1");
updateList = List();
for each invoice in invoiced_this_week
{
job_no = invoice.get("Job_Number");
hours_this_week = invoice.get("Estimated_Time_Allocation_charged");
project_labor_resp = zoho.crm.searchRecords("Project_Labor","(Job_No:equals:" + job_no + ")");
if(project_labor_resp.size() == 1)
{
labour_found = project_labor_resp.get("0");
labour_found_resp = zoho.crm.getRecordById("Project_Labor",labour_found.get("id"));
for each subform in labour_found_resp.get("Labour_Board_Contractors")
{
if(subform.get("Contractors").get("id") == invoiced_contractor)
{
upd_map = subform;
upd_map.put("This_Week_Invoiced_Hour",hours_this_week);
updateList.add(upd_map);
}
else
{
updateList.add(subform);
}
}
info zoho.crm.updateRecord("Project_Labor",labour_found.get("id"),{"Labour_Board_Contractors":updateList});
}
}