Employees in an organization work across several projects simultaneously. Their work hours are split among multiple tasks from different projects. Logging time for each task manually can lead to inconsistency, and the effort rarely gets divided equally. With percentage-based time allocation, you can set the share of an employee's hours that each task should receive. Once the split is applied on a recurring basis, billing stays accurate without manual accounting.
Consider an audit firm where each client account is managed as an individual project. The associates in the firm work on multiple projects at the same time. At the beginning of each contract, the senior auditor estimates each associate's capacity, assigns them to projects, and sets a fixed percentage of their working hours for each project.
To automate time logging, the senior auditor records the percentage of total work hours for each associate in a custom module. A custom function calculates the allocated work hours based on the percentage and logs time for each associate. A weekly time-based workflow rule triggers the custom function until project completion.
To configure this automation in your Zoho Projects portal:
1. Navigate to the upper-right corner and click
→ Customization → Modules and Tabs click
New Module to create a
Project Custom Module.
2. Add the following fields to the module:
- Title field/Number Field - To store the allocation percentage.
- User Picklist - To assign the employee to the time log.
3. Enter the percentage value in the Title field and select the respective user in the User Picklist field.
4. Navigate to
→ Developer Space → Connections. Click
Create Connection, choose Zoho Projects as the service, and add the following scopes:
- ZohoProjects.timesheets.CREATE
- ZohoProjects.custom_fields.READ
- ZohoProjects.portals.READ
5. Navigate to
Custom Functions under
Developer Space and click the
Projects tab in the top panel.
6. Create a new Custom Function and add the below Deluge script.
Ensure the user picklist field has values for the custom function to execute as expected.
- // scopes: ZohoProjects.timesheets.CREATE, ZohoProjects.custom_fields.READ, ZohoProjects.portals.READ
- getModules = invokeurl
- [
- url :projectsEndpointV3 + "/portal/" + portalId + "/settings/modules"
- type :GET
- connection:"projectscustom"
- ];
- for each module in getModules
- {
- if(module.containskey("plural_name"))
- {
- isModulePresent = equalsIgnoreCase(module.get("plural_name"),moduleName);
- }
- else
- {
- isModulePresent = equalsIgnoreCase(module.get("singular_name"),moduleName);
- }
- if(isModulePresent == true)
- {
- moduleId = module.get("id");
- }
- }
- if(moduleId != null)
- {
- param = Map();
- param.put("project_id",projectId);
- getEntityList = invokeurl
- [
- url :projectsEndpointV3 + "/portal/" + portalId + "/module/" + moduleId + "/entities"
- type :GET
- parameters:param
- connection:"projectscustom"
- ];
- if(getEntityList.size() > 0)
- {
- params = List();
- for each entity in getEntityList
- {
- totalMinutes = (40 * 60 * entity.get("name").toDecimal()) / 40;
- hours = floor(totalMinutes / 60);
- minutes = totalMinutes % 60;
- logHours = hours.toLong().toString().leftPad(2).replaceAll(" ","0") + ":" + minutes.toLong().toString().leftPad(2).replaceAll(" ","0");
- param = Map();
- param.put("project_id",projectId);
- param.put("type","general");
- param.put("date",zoho.currentdate.toString("yyyy-MM-dd"));
- param.put("bill_status","Billable");
- param.put("log_name","Log filed");
- param.put("hours",logHours);
- param.put("owner_zpuid",entity.get("user_cf_api_name").get("zpuid"));
- param.put("status","Approved");
- params.add(param);
- }
- obj = Map();
- obj.put("log_object",params);
- getTimelog = invokeurl
- [
- url :projectsEndpointV3 + "/portal/" + portalId + "/addbulktimelogs"
- type :POST
- parameters:obj
- connection:"projectscustom"
- ];
- }
- }
- return "success";
Lines 4, 32, 61 - Replace "projectscustom" with your Zoho Projects connection name.
7. Add the following arguments during configuration:
|
Argument
|
Value
|
|
projectsEndpointV3
|
|
|
portalId
|
Portal ID
|
|
projectId
|
Project ID
|
|
moduleName
|
Expense (or your custom module name)
|
|
user
|
API name of the User Picklist field
|
- Ensure that the portal URL in the arguments align with your data centre. If not, the function may not execute as expected
- Replace moduleName value with the respective custom module name if you have renamed it.
8. Click Save.
9. Navigate to Customization → Layouts, select the required layout, and add a custom date field as per your preference, here it is Budgeting Date.
10. Navigate to
→ Automation → Workflow Rules. Click the
Projects tab and click
New Workflow Rule.
11. Select Based on Date & Time as the execution condition. Configure the rest as below to execute it weekly until project completion. You can also change up the condition and criteria based on your requirements.
12. Click +Add Action and select Associate Custom Function. Select the custom function created previously.
13. Click Save Rule and toggle the Workflow Rule Status on to enable it.
This custom date field triggers the automation. It shifts by 7 days after each execution, ensuring weekly recurrence until project completion.