Power of Automation :: Implementing Deadline-Based Task Scoring with Custom Fields

Power of Automation :: Implementing Deadline-Based Task Scoring with Custom Fields

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. 


Requirement:- 


Implement a task scoring system based on task completion dates.

A custom field named ‘Scoring’ has been created within the Tasks module and it will be used to store the calculated score.

The following explains the logic:

If a task is completed on or before its due date, it should be assigned a score of 100.

For every 3-day delay beyond the due date, 30 points should be deducted from the score.

Here is an example for better understanding.

3 days late → Score: 70

6 days late → Score: 40

9 days late → Score: 10

10+ days late → Score: 0 (minimum score threshold if needed)

This can be accomplished using the features Custom Functions & Workflow Rules. Create a connection using the scopes “ZohoProjects.portals.ALL, ZohoProjects.tasks.ALL" and update the connection name ‘connectionprojects’ in the below code. Find the attached screenshots of the Arguments & Workflow.

Here is the code ::
endPoint = "https://projectsapi.zoho.com/restapi/portal/";
updateTaskParameter = Map();
if(completedDate != null && dueDate != null)
{
delayFieldName = "Score";
daysDiff = daysBetween(toDate(toString(dueDate,format)),toDate(toString(completedDate,format)));
if(daysDiff <= 0)
{
score = 100;
}
if(daysDiff > 0 && daysDiff <= 3)
{
score = 70;
}
if(daysDiff > 3 && daysDiff <= 6)
{
score = 40;
}
if(daysDiff > 6 && daysDiff <= 9)
{
score = 10;
}
if(daysDiff > 9)
{
score = 0;
}
// Get task layout details
taskLayoutDetailsResponse = invokeurl
[
url :endPoint + portalId + "/projects/" + projectId + "/tasklayouts"
type :GET
connection:"connectionprojects"
];
sectionDetails = taskLayoutDetailsResponse.get("section_details");
for each  section in sectionDetails
{
customFieldDetails = section.get("customfield_details");
for each  customFieldDetail in customFieldDetails
{
if(customFieldDetail.get("display_name").containsIgnoreCase(delayFieldName))
{
delayFieldId = customFieldDetail.get("column_name");
break;
}
}
}
updateTaskParameter.put("custom_fields",{delayFieldId:score});
updateTaskResponse = zoho.projects.update(portalId,projectId,"tasks",taskId,updateTaskParameter,"connectionprojects");
}
return "success";

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

    • 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
    • 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:

    Nederlandse Hulpbronnen


      • Recent Topics

      • Enable History Tracking for Picklist Values Not Available

        When I create a custom picklist field in Deals, the "Enable History Tracking for Picklist Values" option is not available in the Edit Properties area of the picklist. When I create a picklist in any other Module, that option is available. Is there a specific reason why this isn't available for fields in the Deals Module?
      • Creating Payrun summary by fetching values from the employee payruns and adding them

        I am trying to make a processing payrun module. I want on Form load to autofill payrun summary eg Total Deductions, Total employer contributions etc by fetching one value after the other in the employee payrun information. So it should loop through the
      • Creator - Portal Custom Domain

        I will pay $100 in crypto to anyone who can actually get my Creator Custom Domain to function (actually tell me how you got yours to).  Domain verifies, Nothing. I've been fighting it a week, multiple chats to customer service. Clearly I'm doing something wrong.  Some datapoints Domain name itself unimportant, can be a string of numbers.  I need to know what registrars are working for you because GoDaddy does NOT.  Do I need hosting? I've tried both ways and nothing works.  I pushed through Cloudflare
      • Feature Request - Zoho Books - Add Retainer Invoices to CRM/Books integration

        Hi Books Team, My feature request is to include Retainer Invoices in the finance suite integration with Zoho CRM. This way we will be able to see if retainer invoices have been issued and paid. I have also noticed that when the generate retainer invoice
      • Books <-> CRM synchronisation with custom Fields

        Hello, We are synchronising Books Customers with CRM Accounts. In CRM Accounts I set up last year a "segments" multiselect field shown below In Books, I set up a custom multi-select field with the same value as in the CRM And set up the synchronisation inside Books. Want to synchronise the Books Segments with the CRM Segments, but the later doesn't exist, and another non-existing is there ?! First, I don't understand where the field Segmentation is coming from. Second, I set CRM Segmentation to sync
      • Edit Reconciled Transactions

        I realize transaction amounts and certain accounts cannot be edited easily once reconciled, but when I audit my operational transactions quarterly and at the end of the year sometimes I need to change the expense account for a few transactions. To do
      • Request to Customize Module Bar Placement in New Zoho CRM UI

        Hello Support and Zoho Community, I've been exploring the new UI of Zoho CRM "For Everyone" and have noticed a potential concern for my users. We are accustomed to having the module names displayed across the top, which made navigation more intuitive
      • Sending campaigns from other server

        Hi, Is it possible to send campaigns from another server so customers can see mail direct from our company (Corrata) and not from ZCSend.net? Thanks, Tim
      • Edit a previous reconciliation

        I realized that during my March bank reconciliation, I chose the wrong check to reconcile (they were for the same amount on the same date, I just chose the wrong check to reconcile). So now, the incorrect check is showing as un-reconciled. Is there any way I can edit a previous reconciliation (this is 7 months ago) so I can adjust the check that was reconciled? The amounts are exactly the same and it won't change my ending balance.
      • Admin and Dispatcher Users show as Field Technicians in Dispatch Module?

        Hi Zoho, Our Admin and Dispatch user both show up as Fied Technicians / Field Agents in the Dispatch module, but they most certainly should not be assigned to any of the work orders and service appointments. These users are NOT service resources. How
      • Don't understand INVALID_REQUEST_METHOD when I try to post up an attachment

        When I make the POST request (using python requests.post() for files): https://www.zohoapis.com/crm/v8/Calls/***************01/Attachments I get this response: r:{ "code": "INVALID_REQUEST_METHOD", "details": {}, "message": "The http request method type
      • Zoho Payroll: Product Updates - June 2025

        This June, we’re taking a giant step forward. One that reflects what we’ve heard from you, the businesses that power economies. For our customers using the latest version of Zoho Payroll (organizations created after Dec 12, 2024) in the United States,
      • View Products (items) in Contact and Company

        Hi, I would like to know if there is an option to view all the products /(items) that were inserted in the pipeline deal stage for exemple "Win Pipeline" within the company and contacts module section? For instance, view with the option filter for the
      • Update subform dropdown field choices - on load workflow

        Hi, I have a "Check In" form that has "Contacts" subform and a "Tickets" subform. When the form is loaded, I want to populate one contact and the number of tickets. I want the "Contact" field in the "Tickets" subform to have the choice of "Contacts."
      • Upload Zoho Inventory Item Image by API

        itemID = item.get("item_id"); organizationID = organization.get("organization_id"); resvp = zoho.inventory.getRecordsByID("items",organizationID,itemID,"zoho_inventory_conn"); info resvp; image_file = invokeurl [ url: "https://t4.ftcdn.net/jpg/03/13/59/81/360_F_313598127_M2n9aSAYVsfYuSSVytPuYpLAwSEp5lxH.jpg"
      • Salesforce to Zoho One Migration

        HI, I am about to start a migration from Salesforce to Zoho One I would like to know the best practise for this, my current thoughts to the approach is 1) Create fields, modules as required for migrating data 2) migrate Data 3) go live Will this approach
      • Zoho Expense Integration with Zoho Books

        I want to know what flexibility do i have in selecting the chart of accounts which get a hit whenever we are posting any expense or advance in zoho expense?
      • Custom Function to Update Ticket based on Subject of Ticket

        This may be pretty simple but I'm having issues with getting a custom function to fill out custom fields based on the subject of a ticket and not the body of a ticket. Basically we need to fill in the PO number and Item ID custom fields, both of this
      • Incoming 'Message' data via WhatsApp appears empty

        the Incoming 'Message' data via WhatsApp appears empty; instead of customer messages, I only see CRM system notification messages are being displayed. I have seen 3 messages like this since yesterday it seems that in 'All Message' the message snippet
      • Handling Automatic Replies in Desk

        We send out email campaigns (currently via Klaviyo) and naturally we receive "Automatic Replies" to these mass email campaigns. These responses are all being routed to Zoho Desk. We get two types of "Automatic Replies" Type 1) Customer is out of the office/holiday
      • Zoho Mail API Error EXTRA_KEY_FOUND_IN_JSON

        I have a workflow set up in Pipedream that uses the Zoho Mail API to send emails from my account. It's worked without issue for months but today I'm getting the following 404 error for every email I try to send: { "data": { "errorCode": "EXTRA_KEY_FOUND_IN_JSON"
      • How to search (web API) for a Calls record by phone number?

        Using v8 /Calls/search web api I'm unable to to complete a search request no matter how I use the api: When I try using "criteria=" I get: response: <Response [400]> response_json: { "code": "INVALID_QUERY", "details": { "reason": "the field is not available
      • [Free Webinar] Product Release Updates - Creator Tech Connect

        Hello Everyone! We welcome you all to the upcoming free webinar on the Creator Tech Connect Series. The Creator Tech Connect series is a free monthly webinar that runs for around 45 minutes. It comprises technical sessions in which we delve deep into
      • Zoho GenAI API Error Not a valid response from zia.

        Zoho GenAI API Error Not a valid response from zia.
      • Help me to retreive my Document

        Please help me to retrieve my documents from any date between 1st February, 2025 to 20th,March 2025 .it got mistakenly deleted on the 21 of March 2025 due to phone screen malfunction I earnestly await your positive response .thank you
      • how to change the page signers see after signing a document in zoho sign

        Hello, How can I please change the page a signer sees after signing a document in Zoho Sign? I cannot seem to find it. As it is now, it shows a default landing page "return to Zoho Sign Home". Thanks!
      • Look Up Field Type not available for events and tasks?

        Look Up Field Type not available for events and tasks?    
      • I cannot check out to Zoho People.

        When I tried to check out today, there's prompt that inhibits me to check out: To add entry in Attendance, log time for any of your jobs
      • Digest Juin - Un résumé de ce qui s'est passé le mois dernier sur Community

        Bonjour à toutes et à tous, Ce mois-ci encore, tout s’est enchaîné à toute vitesse ! On vous fait un petit récap de ce qui a marqué ces dernières semaines. Zoho RPA est une solution robuste d’automatisation des processus, conçue pour s’intégrer aux systèmes
      • Different Transaction Series for Different Types of Sales

        Is there any way I can create multiple transaction series for different type of Sales? Say B2B-001 and B2C -001 for respective type of Sales.?
      • Unable to charge GST on shipping/packing & Forwarding charges in INDIA

        Currently, tax rates only apply to items. It does not apply tax to any shipping or packing & forwarding charges that may be on the order as well. However, these charges are taxable under GST in India. Please add the ability to apply tax to these charges.
      • Customer Advance Zoho Book API

        All I could find was Customer Payment API, it does not have facility to add customer advances, where those are not linked to any invoice as such. How to do it?
      • Even though the received amount+tax is equal to or lesser than the invoice value, zoho doesnt allow to record

        Even though the received amount+tax is equal to or lesser than the invoice value, Zoho mentioned the error- you've recorded more payment than the actual invoice balance. please check again. screenshot also attached.  You've recorded more payment than
      • Multiple deductions in invoice

        I issue invoices to a customer that include multiple deductions that I would like to track in different expense accounts. But that is not possible in Zoho Books as there is only one Deduction field and even that I don't have control over to assign it
      • #BiginnersTips | How to bulk update closing dates for multiple deals in Bigin

        Hello Biginners! Keeping your CRM data accurate is crucial for any business- big or small. One key aspect is ensuring that closing dates for deals are always up to date. Why? Because if a deal is closed but not updated, your dashboards and reports would
      • 采购里出现付款通知 的错误

        采购里面出现付款通知错误,怎么调整,我找不到路径,好像是ZOHO 自动生成的,请问怎么调整
      • {"code":1002,"message":"Statement of Accounts does not exist."}

        Hello Zoho team, I faced an issue while trying to POST a sales order from sap to zoho books, using the below data packet: {   "customer_id": "4322967000027451968",   "line_items": [     {       "item_id": "2154170000010847685",       "rate": "752.00",
      • Add Custom Fields only in Customer module and not on supplier module!? Is not there a way to do that!?

        I am trying to create custom fields on clients module but it also gets created on suppliers module; which of course does not make sense at all as a lot of custom fields are client or supplier specific but never both. I am missing something? This seems
      • Logging website service fees

        Hello, I do a lot of freelance work on sites like Upwork and Wyzant and others and those companies take a small cut from what I pay or what I earn and I am wondering what is the correct way to log this in my books. For example if I charge $55 per hour
      • How do i clear a liability account without making a payment?

        I have a liability account with a provision for an expected bill from previous years. However the bill never arrived and the provision/liability account with Cr balance has been carried forward for many years now. How do i know clear the provision made
      • Next Page