Power of Automation :: Automated Weekly Notifications for Unapproved Timesheets

Power of Automation :: Automated Weekly Notifications for Unapproved Timesheets

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. 


We also support a feature Schedule Function which allows you to execute custom functions based on a specified schedule such as hourly, daily, weekly, or monthly. This feature can be used for recurring actions, like generating monthly reports or sending automated emails to portal users about upcoming public milestones or deadlines without relying on specific events.

Below is the use case ::

To automatically send weekly email notifications to the project owner regarding any unapproved timesheets associated with their project(s).

This can be accomplished using the feature Schedule FunctionsCreate a connection with the service Zoho Projects using the scopes ZohoProjects.projects.READ,ZohoProjects.timesheets.READ" and update the connection name ‘projects’ in the below code. Attached a screenshot of Schedule Function.
timesheetViewId = XXXXXXXXXX; // Replace All Pending timesheet view id here
paramMap = Map();
paramMap.put("page",1);
paramMap.put("per_page",200);
paramMap.put("view_id",XXXXXXXXXXX); // Replace active projects view id here
getAllProjects = invokeurl
[
url :projectsEndpoint + portalId + "/projects/"
type :GET
parameters:paramMap
connection:"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 :URL
type :GET
parameters:info
connection:"projects"
];
info getTimesheet;
/*
If empty = {"time_logs":[]}
*/
if (getTimesheet.get("time_logs").size()>0) {
sendmail
[
from: zoho.loginuserid
to: 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>"

]
}
}
Creating custom functions in Zoho Projects is straightforward and well-documented. Zoho provides a range of built-in functions that you can use as a starting point, and you can also easily define your own functions using Zoho's scripting language, Deluge. Give it a try and see how it can save your time and boost your productivity!

Watch this space for more such custom function codes.
    • Sticky Posts

    • Set Custom Business Calendars and Holidays for Global Teams

      Managing a project across diverse teams means accounting for more than just tasks and deadlines; it means acknowledging how and when each team actually works. Users might follow different working days or observe region-specific holidays that cannot be
    • Introducing Version-3 APIs - Explore New APIs & Enhancements

      Happy to announce the release of Version 3 (V3) APIs with an easy to use interface, new APIs, and more examples to help you understand and access the APIs better. V3 APIs can be accessed through our new link, where you can explore our complete documentation,
    • Restore Trashed Records Anytime Within 30 Days

      Access the recycle bin from the Data Administration tab under the settings page in Zoho Projects, which gives better control over the trashed data. When records like projects, phases, task lists, tasks, issues, or project templates are trashed, they are
    • Organize and Clone Task Custom Views

      We have rolled out two new enhancements to task custom views: Custom View Groups and Custom View Clone. Custom View Groups Similar to predefined view groups, we have introduced groups for custom views to help organize and categorize them. My Custom Views:
    • Flexible Milestone Invoicing

      If your Zoho Projects portal is integrated with Zoho Invoice/Books, you can now create an invoice for your milestones. You can enable it under Integration Preference and invoice milestones regardless of the project's billing type. For instance, consider