If you want to fetch & update records in Sub Form in any module of Zoho CRM. Please use the following code:
Deluge Code:
data = zoho.crm.getRecordById("Asset_Master",ID);//fetchRecord
sub = data.get("Contract_Information");//AccessSubbform
revisitdeal = List:Map();
for each condate in sub
{
innermap = Map();//Create Map Function
Contract_Start_Date = condate.get("Contract_Start_Date");//FetchedtheDate
Contract_Period = condate.getJSON("Contract_Period");//Lookup
if(Contract_Period != null)
{
Contract_PeriodID = condate.getJSON("Contract_Period").get("id");//LookupID
Contract_Period = condate.getJSON("Contract_Period").get("name");//LookupName
}
if(Contract_Period != null)
{
if(Contract_Period == "03 MONTH")
{
Contract_End_Date = Contract_Start_Date.addMonth(3);//Add3Months
}
}
No_of_Calls_Site_Visit = condate.get("No_of_Calls_Site_Visit");
notify_Date = Contract_End_Date.subMonth(1);//Deduct1MonthfromDate
innermap.put("Contract_Start_Date",Contract_Start_Date);
innermap.put("Contract_Expiry_Date",Contract_End_Date.toString("yyyy-MM-dd"));//DateFormatChange
innermap.put("Contract_Period",{"id":Contract_PeriodID,"name":Contract_Period});//LookupValueSet
innermap.put("No_of_Calls_Site_Visit",No_of_Calls_Site_Visit);
revisitdeal.add(innermap);
mp.put("Contract_Information",revisitdeal);
}
update = zoho.crm.updateRecord("Asset_Master",ID,mp);