Hello Everyone,
A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate complex tasks and calculations.
timesheetViewId = XXXXXXXXXX; // Replace All Pending timesheet view id hereparamMap = Map();paramMap.put("page",1);paramMap.put("per_page",200);paramMap.put("view_id",XXXXXXXXXXX); // Replace active projects view id heregetAllProjects = invokeurl[url :projectsEndpoint + portalId + "/projects/"type :GETparameters:paramMapconnection:"projects"];// info getAllProjects;for each project in getAllProjects.get("projects"){projectId = project.get("id");projectName = project.get("name");budget_info = Map();info = Map();info.put("view_type","projectspan");info.put("view_id",timesheetViewId);info.put("module",{"type":"task"});budget_info.put("budget_info",info);URL = projectsEndpointV3 + portalId + "/projects/" + projectId + "/timesheet";getTimesheet = invokeurl[url :URLtype :GETparameters:infoconnection:"projects"];info getTimesheet;/*If empty = {"time_logs":[]}*/if (getTimesheet.get("time_logs").size()>0) {timesheetUrl = "https://projects.zoho.com/portal/"+portalName+"#zp/projects/"+projectId+"/timelogs/custom-view/"+timesheetViewId+"/list";sendmail[from: zoho.loginuseridto: project.get("owner_email")subject: "Weekly Reminder: Pending Timesheets for Approval"message: "<p>There are some timesheets awaiting your approval in the project:
<b><a href="+timesheetUrl+">"+projectName+"</a></b><br></p>"]}}