Power of Automation :: Automatically approve the pending timelogs at your preferred time

Power of Automation :: Automatically approve the pending timelogs at your preferred time

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. 


Below is the requirement:


Our customer approached with the below requirement - They want an automation that all the pending timelogs should be automatically approved in the first week of every month. Likewise, it is possible to configure as per your preferred time.

We had accomplished this requirement using Schedule functions. This 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.


Create a connection for the Zoho Projects service with the scopes "ZohoProjects.timesheets.ALL' to replace ‘projects’ with the connection name. Click this link below to learn how to create the connection. Attached a screenshot of the Schedule Function for reference.


Script to be used:


endPointV3 = "https://projects.zoho.com/api/v3/portal/";

logParamList = List();

moduleTemplate = Map();

moduleTemplate.put("type","task");

timesheetParam = Map();

timesheetParam.put("view_type","month");

timesheetParam.put("module",moduleTemplate);

timesheetParam.put("start_date",zoho.currentdate.addMonth(-1));

timesheetParam.put("end_date",zoho.currentdate);

taskTimesheetResponse = invokeurl

[

url :endPointV3 + portalId + "/timesheet"

type :GET

parameters:timesheetParam

connection:"projects"

];

// info taskTimesheetResponse;

if(taskTimesheetResponse != null)

{

for each  time_log in taskTimesheetResponse.get("time_logs")

{

for each  logs in time_log.get("log_details")

{

logDetail = Map();

logDetail.put("approval_status","approved");

logDetail.put("module","task");

logDetail.put("id",logs.get("id"));

logParamList.add(logDetail);

}

}

}

genralLogIds = Map();

moduleTemplate.clear();

timesheetParam.remove("module");

moduleTemplate.put("type","general");

timesheetParam.put("module",moduleTemplate);

generalTimesheetResponse = invokeurl

[

url :endPointV3 + portalId + "/timesheet"

type :GET

parameters:timesheetParam

connection:"projects"

];

// info generalTimesheetResponse;

if(generalTimesheetResponse != null)

{

for each  time_log in generalTimesheetResponse.get("time_logs")

{

for each  logs in time_log.get("log_details")

{

logDetail = Map();

logDetail.put("approval_status","approved");

logDetail.put("module","general");

logDetail.put("id",logs.get("id"));

logParamList.add(logDetail);

}

}

}

issueLogIds = Map();

moduleTemplate.clear();

timesheetParam.remove("module");

moduleTemplate.put("type","issue");

timesheetParam.put("module",moduleTemplate);

issueTimesheetResponse = invokeurl

[

url :endPointV3 + portalId + "/timesheet"

type :GET

parameters:timesheetParam

connection:"projects"

];

// info issueTimesheetResponse;

if(issueTimesheetResponse != null)

{

for each  time_log in issueTimesheetResponse.get("time_logs")

{

for each  logs in time_log.get("log_details")

{

logDetail = Map();

logDetail.put("approval_status","approved");

logDetail.put("module","issue");

logDetail.put("id",logs.get("id"));

logParamList.add(logDetail);

}

}

}

approveTimesheets = invokeurl

[

url :endPointV3 + portalId + "/logs"

type :PATCH

parameters: "["+logParamList.toString()+"]"

connection:"projects"

];

info approveTimesheets;

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

      • 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,
      • Schedule Exports for Regular Project Updates

        Tracking project data often means exporting data at regular intervals. Instead of manually exporting data every time, users can schedule exports for Phases, Tasks, and Tasks in Zoho Projects. These exports can be set to run once, daily, weekly, or monthly
      • 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
      • 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:

        • Recent Topics

        • Payment issue with Mail Lite plan – personal NIF not accepted as payment info

          Hello, I have already contacted Zoho Support by email regarding this, but since I haven’t received any reply yet, I’m sharing it here as well to see if the community can help. I’m facing a payment issue for my Mail Lite plan. I have a personal account
        • Customer payment alerts in Zoho Cliq

          For businesses that depend on cash flow, payment updates are essential for operational decision-making and go beyond simple accounting entries. The sales team needs to be notified when invoices are cleared so that upcoming orders can be released. In contrast,
        • {"code":1038,"message":"JSON is not well formed"}

          Today this began failing: sales_order_data = zoho.books.createRecord("salesorders",books_organization_ID,order_data); with this error message. {"code":1038,"message":"JSON is not well formed"} This code has been running for two years. Here is the input
        • Zoho Editor

          Zoho PDf Editor is not working I am clicking on EDIT PDf then it again bringing me back to the same page. again and again.
        • Figma in Zoho Creator

          Hi Team, I’m creating a form using Figma and would like to know how to add workflows like scheduling, custom validation, and other logic to it. Can anyone help me understand how to set this up for a Figma-based Creator UI form?
        • How to Delete Personal Account Linked with My Mobile Number in past or by someone else

          How to Delete Account Created with My Mobile Number in past or by someone else This is creating issues in making or sync with my credentials mobile and email address..
        • Enable / show scroll bar when Mega Menu is opened

          Hey there I am using the mega menu add-on and experience a "flicker" whenever the mega menu opens. The reason is, that the scrollbar, which has a width of a few pixels, stops showing when the mega menu opens. As the scrollbar disappears the whole page
        • Restore lost Invoice!

          Some time ago I tried to Upgrade from Invoice to Books. I not upgraded and staid n Invoice. Now i tried again and first i deleted the old trial of books. But now all is gone, PLEASE HELP!! i have no backup and i have to have at least 7 years data retention by law. 
        • Zoho Desk Down

          Not loading
        • lookup and integrated forms

          I might be misunderstanding things but I wanted to integrate our zoho crm contacts into creator. I imagined that when I used the integration it would mirror into creator. It did brilliant. BUT We have a ticket form in creator that we want to use a lookup
        • Partially receive PO without partial Bill?

          Most of our inventory is pre-paid. Let's say we purchase 30 pieces of 3 different items for a total of 90 pieces. It is common for our supplier to send us the items as they are ready. So we will receive 30 pieces at a time. How can I partially receive
        • 2 users editing the same record - loose changes

          Hello, I'm very new to Zoho so apology if this has been addressed somewhere i can't find. I have noticed the following: If we have 2 users put an inventory item in edit mode at the same time: say user1 click on edit and user2 while user1 is still in edit,
        • How to get the Dashboard page to be the first page when you open the app

          So when it opens on a tablet or phone it opens on the welcome page, thanks.
        • How I set default email addresses for Sales Orders and Invoices

          I have customers that have different departments that handle Sales Orders and Invoices. How can i set a default email for Sales Orders that's different than the default email for Invoices? Is there a way I can automate this using the Contact Persons Departments
        • Adding hyperlinks in CRM emails time automatically

          It may just be me, but when I am writing an email to a lead, I find inserting a hyperlink very time consuming. Granted, I can use templates but there are a ton of scenarios where I might want to put a link in to an website that wouldnt require me to go though the effort of creating a template.  Ideally, the crm would identify that I that a string of text is a URL and insert the hyperlink automatically, just like microsoft outlook or gmail. Has anyone else had this same experience and found a way
        • Notes Attachments

          Two things it would be nice to have the attachment size the same as the attachments sections and it would be nice to be able to attach links like you can in the attachments section. Thank you
        • Zoho Sheet - Desktop App or Offline

          Since Zoho Docs is now available as a desktop app and offline, when is a realistic ETA for Sheet to have the same functionality?I am surprised this was not laucned at the same time as Docs.
        • Formula fields not refreshing until page is reloaded

          I need help/advice about the formula fields and how I can refresh the information in real-time. We have two formula fields on our deals page which show calculated prices: One formula is in a subform which calculates the subform total + 1 other field amount
        • How can I setup Zoho MCP with Chat GPT

          I can set up custom connections with Chat GPT but I cat an error when I try to set it up. The error is: "This MCP server can't be used by ChatGPT to search information because it doesn't implement our specification: search action not found" Thoughts?
        • Export Invoices to XML file

          Namaste! ZOHO suite of Apps is awesome and we as Partner, would like to use and implement the app´s from the Financial suite like ZOHO Invoice, but, in Portugal, we can only use certified Invoice Software and for this reason, we need to develop/customize on top of ZOHO Invoice to create an XML file with specific information and after this, go to the government and certified the software. As soon as we have for example, ZOHO CRM integrated with ZOHO Invoice up and running, our business opportunities
        • API ZOHO CRM Picket list with wrong values

          I am using Zoho API v.8. with python to create records in a custom module named "Veranstaltung" in this custom module I've got a picket list called "Email_Template" with 28 Values. I've added 8 new values yesterday, but if I try to use on of those values
        • Group Emails

          I have synced Zoho CRM to Campaigns but there are certain email not synced. showing it is Group Emails, but this email ids belongs to different individuals. please provide a solution as i nedd to sync the same.
        • Enable Password Import option in ulaa browser

          Dear Ulaa Team, I noticed that the Ulaa Password Manager currently offers an option to export passwords, but not to import them. This limitation poses a challenge for users like me who have stored numerous credentials in browsers like Chrome. Manually
        • "Is Zoho CRM customer" vs "Is linked with Zoho CRM"

          Recently while building a Flow, I was setting up a Decision action following a Zoho Invoice Fetch record action. There were 2 choices that I had not seen as something I could manually action in Zoho Invoice: "Is Zoho CRM customer" and "Is linked with
        • Client Script | Update #13 - Introducing ZRC: Simplified HTTP request library

          Hello Developers! Are you tired of juggling different methods to make API calls? Are you confused with multiple syntaxes and version restrictions? Have you ever wished for one simple way to make all API calls in CRM? We heard you :) Here comes ZRC (Zoho
        • Selection Filed for Data Export section

          Hi FSM Team, I hope you are all doing well. I would like to share an idea for future development based on my experience. Currently, in FSM, we can only download up to 5,000 records at a time. If the development team could add a selection option to choose
        • Text wrap column headers in reports?

          Is it possible to auto wrap column headers so that a longer multi-word header displays as two lines when the column is narrower than the width of the header title?
        • What if I dont see contacts on the left side list

          My CRM does not show the contacts tab. In order to create list this is needed and I cant find it.
        • Comments Vs. Replies

          I'm curious as to the difference between a "Reply" and a "Comment" on a ticket. It appears that "Replies" are what's used to determine response time SLA's and there are also used to automatically re-open tickets. I'm just trying to understand the key differences so I can educate both our clientele and our back-end users on which function/feature to use to better improve the ticket lifecycle. If anyone has any insight it would be appreciated. Thanks!
        • Transitioning to API Credits in Zoho Desk

          At Zoho Desk, we’re always looking for ways to help keep your business operations running smoothly. This includes empowering teams that rely on APIs for essential integrations, functions and extensions. We’ve reimagined how API usage is measured to give
        • Add Custom Reports To Dashboard or Home Tab

          Hi there, I think it would be great to be able to add our custom reports to the Home Tab or Dashboards. Thanks! Chad
        • Resetting auto-number on new year

          Hi everyone! We have an auto-number with prefix "D{YYYY}-", it generates numbers like D2025-1, D2025-2, etc... How can we have it auto-reset at the beginning of the next year, so that it goes to D2026-1? Thanks!
        • Microsoft Phone Link

          Does anyone know if you can use Microsoft Phone Link to make calls through Zoho?
        • Voip Phone system that integrates with Zoho

          Just checking to see if anyone could tell me what phone system they are using with Zoho that is on the list of systems that integrate with Zoho.  I use Vonage and have been with them for quite a few years but their service has really gone down hill and
        • Removing Related Modules Lookup Fields Assignment / Relationship

          Issue: When creating a related list, I accidently selected module itself creating a circle reference. See attached. Situation: I wish to relating a custom module called "Phone Calls" to Leads and Contacts. Outcome: 1) I either want to remove the this
        • [Product Update] TimeSheets module is now renamed as Time Logs in Zoho Projects.

          Dear Zoho Analytics customers, As part of the ongoing enhancements in Zoho Projects, the Timesheets module has been renamed to Time Logs. However, the module name will continue to be displayed as Timesheets in Zoho Analytics until the relevant APIs are
        • Kaizen #210 - Answering your Questions | Event Management System using ZDK CLI

          Hello Everyone, Welcome back to yet another post in the Kaizen Series! As you already may know, for the Kaizen #200 milestone, we asked for your feedback and many of you suggested topics for us to discuss. We have been writing on these topics over the
        • Can you prevent closing Ulaa window when the last tab is closed (inadvertently)?

          Most browsers have started to bring this feature in to prevent closing their windows when the last tab is closed (inadvertently). I hope Ulaa should get this in too.
        • Seriously - Create multiple contacts for leads, (With Company as lead) Zoho CRM

          In Zoho CRM, considering a comapny as a lead, you need us to allow addition of more than one contact. Currently the Lead Section is missing "Add contact" feature which is available in "Accounts". When you know that a particular lead can have multiple
        • can I link a contacts to multiple accounts

          can I link a contacts to multiple accounts
        • Next Page