I need to collect all of an employee's leave requests for the calendar year and check how many half-days they have taken.
If I run the script on the query he just modified, I can retrieve the information related to that query and use the get("LeaveCount")
LeaveDayDetails = LeaveReq.get("DayDetails");
for each LeaveDay in LeaveDayDetails
{
LeaveCount = LeaveDay.get("LeaveCount");
if(LeaveCount = 0.5)
{
CountHalf = CountHalf + 1;
}
}
But in reality, I have to read all the leave requests for the calendar year and check the details of each one. I don't know how to Retrieve the detail for each leave.
dat = Map();
searchMap1 = Map();
searchMap1.put("searchField","Employee_ID");
searchMap1.put("searchOperator","Is");
searchMap1.put("searchText",Ee_num);
searchMap2 = Map();
searchMap2.put("searchField","From");
searchMap2.put("searchOperator","Between");
searchMap2.put("searchText",DateRange);
searchMap2.put("searchCriteria","AND");
searchMap3 = Map();
searchMap3.put("searchField","Leavetype");
searchMap3.put("searchOperator","Contains");
searchMap3.put("searchText","Annual H");
searchMap3.put("searchCriteria","AND");
////Create list to hold all the search conditions
searchList = List();
searchList.add(searchMap1);
searchList.add(searchMap2);
searchList.add(searchMap3);
// Execute the get records task to fetch the search result
response = zoho.people.getRecords("leave",1,20,searchList);
for each LeaveReq in response
{
LeaveType = LeaveReq.get("Leavetype");
FromDt = LeaveReq.get("From");
ToDt = LeaveReq.get("To");
ApprStatus = LeaveReq.get("ApprovalStatus");
Daystaken = LeaveReq.get("Daystaken");
if(ApprStatus != "Cancelled" && ApprStatus != "Rejected" || LeaveType == "Annual H")
{
// Retrieve the detail for that leave ????
}
}
Could you please assist?
Thank you.
Veronique