Custom Function for Milestone Auto-Complete

Custom Function for Milestone Auto-Complete

A custom function is a piece of software code that can help automate a process. Users can write their own Custom Functions using deluge and call them from a workflow. Let us take a look at how custom functions can help organizations manage their workflow.

Custom Functions can be used by organizations that want to automatically mark their milestones as complete once all of the tasks within the milestone have been completed. First we need to establish a connection, define a workflow rule and then associate a custom function to that workflow rule.

Create a new connection
  1. Navigate to the Setup icon and select Marketplace.
  2. Click Connections under Marketplace and then Create Connection.
  3. Click Default Services under Pick your service.
  4. Select Zoho Projects.
  5. Enter ZP MS Autocomplete as the Connection name and select the scopes ZohoProjects.milestones.UPDATE, ZohoProjects.bugs.READ, ZohoProjects.tasks.READ, and Zoho Projects.milestones.ALL

  6. Click the Create and Connect button.

  7. You will be prompted to connect to the newly established connection
  8. Click the Proceed button.

  9. The connection will be created once the accept button is clicked.

Note : Remember that 'Use Credentials of Login User' has to be switched off.

Workflow rule for automatically completing a milestone
  1. Click in the top navigation bar.
  2. Navigate to Task Automation and click Workflow Rules.
  3. Click New Workflow Rule.
  4. Enter the workflow name, description, and select the required layout.
  5. Under Execute on, choose 'Update' then Choose 'Field Specific and Select 'Status' from drop down menu.
  6. Click Next.

Create and associate the custom function to the workflow

Next, we will create a custom function and associate it with the workflow rule.
  1. Click on Add Action and then select Associate Custom Function.
  2. Click Create Custom Function in the Associate Custom Function page.

  3. In the Create Custom Function page type in the function name as Milestone Auto Complete.
  4. Add Arguments for project id, portal id, and milestone id as shown in the image below.

  5. Use this as the Sample Code and click Save.
  6. Associate the created Custom Function.

Click Save Rule.


  1. Sample Code: 
    1. // Construct parameter to filter the open tasks
      taskParam = Map();
      taskParam.put("status","notcompleted");
      taskParam.put("milestone_id",milestoneId);
      // Invoke get tasks API
      //Add your connection name as last parameter
      taskResponse = zoho.projects.getRecords(portalId,projectId,"tasks",taskParam,1,"zpmsautocomplete");
      info taskResponse;
      // Variable declaration and assign value , Endpoint of the API
      // This Varibale used to decide the milestone completion
      isMilestoneUpdate = false;
      // If task response is empty it will check any open bugs are available
      if(taskResponse.isEmpty())
      {
      // construct parameter for filter only open bugs
      milestoneList = list();
      milestoneList.add(milestoneId);
      bugParam = Map();
      bugParam.put("statustype","open");
      bugParam.put("milestone",milestoneList);
      info "bugParam:" + bugParam;
      //Add your connection name as last parameter
      bugResponse = zoho.projects.getRecords(portalId,projectId,"bugs",bugParam,1,"zpmsautocomplete");
      info bugResponse;
      if(bugResponse.isEmpty())
      {
      isMilestoneUpdate = true;
      }
      }
      info "TaskResponse Is Empty :" + taskResponse.isEmpty() + ", isMilestoneUpdate:" + isMilestoneUpdate;
      info "---------------------";
      if(!milestoneId.isNull() && isMilestoneUpdate)
      {
      //Modify the status of the milestone.(1 - notcompleted, 2 - completed)
      milestoneParam = Map();
      milestoneParam.put("status",2);
      info milestoneParam;
      info "---------------------";
      // Enter The Connection option Example : connection:"your_conection_name"
      updateMilestoneResponse = invokeurl
      [
      url :projectsAPIEndPoint + "/portal/" + portalId + "/projects/" + projectId + "/milestones/" + milestoneId + "/status/"
      type :POST
      parameters:milestoneParam
      connection:"zpmsautocomplete"
      ];
      info updateMilestoneResponse;
      info "-------------------------------------";
      } 
      return "success";
We hope you found this post to be helpful.
If you have any questions, please leave them in the comments section below or email us at support@zohoprojects.com.




    Access your files securely from anywhere







                        Zoho Developer Community






                                              • Desk Community Learning Series


                                              • Digest


                                              • Functions


                                              • Meetups


                                              • Kbase


                                              • Resources


                                              • Glossary


                                              • Desk Marketplace


                                              • MVP Corner


                                              • Word of the Day


                                              • Ask the Experts



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


                                                        Manage your brands on social media



                                                              Zoho TeamInbox Resources



                                                                  Zoho CRM Plus Resources

                                                                    Zoho Books Resources


                                                                      Zoho Subscriptions Resources

                                                                        Zoho Projects Resources


                                                                          Zoho Sprints Resources


                                                                            Qntrl Resources


                                                                              Zoho Creator Resources



                                                                                  Zoho CRM Resources

                                                                                  • CRM Community Learning Series

                                                                                    CRM Community Learning Series


                                                                                  • Kaizen

                                                                                    Kaizen

                                                                                  • Functions

                                                                                    Functions

                                                                                  • Meetups

                                                                                    Meetups

                                                                                  • Kbase

                                                                                    Kbase

                                                                                  • Resources

                                                                                    Resources

                                                                                  • Digest

                                                                                    Digest

                                                                                  • CRM Marketplace

                                                                                    CRM Marketplace

                                                                                  • MVP Corner

                                                                                    MVP Corner







                                                                                      Design. Discuss. Deliver.

                                                                                      Create visually engaging stories with Zoho Show.

                                                                                      Get Started Now


                                                                                        Zoho Show Resources


                                                                                          Zoho Writer Writer

                                                                                          Get Started. Write Away!

                                                                                          Writer is a powerful online word processor, designed for collaborative work.

                                                                                            Zoho CRM コンテンツ





                                                                                              Nederlandse Hulpbronnen


                                                                                                  ご検討中の方




                                                                                                        • Recent Topics

                                                                                                        • Elevate your CX delivery using CommandCenter 2.0: Simplified builder; seamless orchestration

                                                                                                          Most businesses want to create memorable customer experiences—but they often find it hard to keep them smooth, especially as they grow. To achieve a state of flow across their processes, teams often stitch together a series of automations using Workflow
                                                                                                        • Unified Directory : How to Access ?

                                                                                                          I signed in to Zoho One this morning and was met with the pop up about the upgraded directory (yay!) I watched the video and pressed "Get Started" ... and it took me back to the standard interface. How do I actually access the new portal/directory ?
                                                                                                        • Translation support expanded for Modules, Subforms and Related Lists

                                                                                                          Hello Everyone!   The translation feature enables organizations to translate certain values in their CRM interface into different languages. Previously, the only values that could be translated were picklist values and field names. However, we have extended
                                                                                                        • Send Automated WhatsApp Messages and Leverage the Improved WhatsApp Templates

                                                                                                          Greetings, I hope all of you are doing well. We're excited to announce a major upgrade to Bigin's WhatsApp integration that brings more flexibility, interactivity, and automation to your customer messaging. WhatsApp message automation You can now use
                                                                                                        • Unified task view

                                                                                                          Possible to enable the unified task view in Trident, that is currently available in Mail?
                                                                                                        • Bigin, more powerful than ever on iOS 26, iPadOS 26, macOS Tahoe, and watchOS 26.

                                                                                                          Hot on the heels of Apple’s latest OS updates, we’ve rolled out several enhancements and features designed to help you get the most from your Apple devices. Enjoy a refined user experience with smoother navigation and a more content-focused Liquid Glass
                                                                                                        • Importing data into Assets

                                                                                                          So we have a module in Zoho CRM called customers equipments. It links to customers modules, accounts (if needed) and products. I made a sample export and created extra fields in zoho fsm assets module. The import fails. Could not find a matching parent
                                                                                                        • Allow instruction field in Job Sheets

                                                                                                          Hello, I would like to know if it is possible to have an instruction field (multi line text) in a job sheet or if there is a workaround to be able to do it. Currently we are pretty limited in terms of fields in job sheets which makes it a bit of a struggle
                                                                                                        • Streamlining Work Order Automation with Zoho Projects, Writer & WorkDrive

                                                                                                          Hello Community, Here is the first post in 'Integration & Automation' Series. Use Case :: Create, Merge, Sign & Store Documents in Zoho WorkDrive. Scenario :: You have a standard Work Order template created in Zoho Writer. When a task status is chosen
                                                                                                        • The dimensions of multilingual power

                                                                                                          Hola, saludos de Zoho Desk. Bonjour, salutations de Zoho Desk. Hallo, Grüße von Zoho Desk. Ciao, saluti da Zoho Desk. Olá, saudações da Zoho Desk. வணக்கம், Zoho Desk இலிருந்து வாழ்த்துகள். 你好,来自 Zoho Desk 的问候。 مرحباً، تحيات من Zoho Desk. नमस्ते, Zoho
                                                                                                        • Multi-line address lines

                                                                                                          How can I enter and migrate the following 123 state street Suite 2 Into a contact address. For Salesforce imports, a CR between the information works. The ZOHO migration tool just ignores it. Plus, I can't seem to even enter it on the standard entry screen.
                                                                                                        • Accessing Zoho Forms

                                                                                                          Hi all, We're having trouble giving me access to our company's Zoho Forms account. I can log in to a Forms account that I can see was set up a year ago, but can't see any shared forms. I can log into Zoho CRM and see our company information there without
                                                                                                        • Archiving Contacts

                                                                                                          How do I archive a list of contacts, or individual contacts?
                                                                                                        • Cost of good field

                                                                                                          Is there a way we can have cost of good sold as a field added to the back end of the invoicing procedure and available in reports?
                                                                                                        • How to add image to items list in Invoice or Estimate?

                                                                                                          Hello! I have just started using Zoho Invoice to create estimates and, possibly to switch from our current CRM/ERP Vendor to Zoho. I have a small company that is installing CCTV systems and Alarm systems. My question is, can I add images of my "items" to item list in Zoho Invoice and Estimates and their description? I would like to show my clients the image of items in our estimates so they can decide if they like these items. And I tell you, often they choose more expensive products just because
                                                                                                        • Issue with the Permission to Zoho Form

                                                                                                          I am getting an error by signing in to zoho form as it is stated that i don't have permission to access this is admin account
                                                                                                        • CRM templates

                                                                                                          Hello everyone, In my company we use Zoho campaigns where we set up all newsletters and we use Zoho CRM for transactional emails. I have created some templates in Zoho campaigns but from my understanding i cannot use those in Zoho CRM, right?
                                                                                                        • Meet Canvas' Grid component: Your easiest way to build responsive record templates

                                                                                                          Visual design can be exciting—until you're knee-deep in the details. Whether it's aligning text boxes to prevent overlaps, fixing negative space, or simply making sure the right data stands out, just ironing out inconsistencies takes a lot of moving parts.
                                                                                                        • Addin Support in Zoho Sheet

                                                                                                          Is there any addin support available in zoho sheet as like google marketplace to enhance productivity by connecting with other apps, providing AI data analysis, streamlining business processes, and more?
                                                                                                        • Where to integrate Price Book and Product List Price

                                                                                                          Hello, We sync zoho crm all modules with all data to zoho analytics. In zoho crm, we have "Price Books" and "Products" modules, where each product is assigned to a few price books with different list prices. From zoho crm, I am able to export a dataset
                                                                                                        • Pending Sales Order Reports

                                                                                                          Pending sale order report is available for any single customer, Individual report is available after 3-4 clicks but consolidated list is needed to know the status each item. please help me.
                                                                                                        • Zoho Mail SMTP IP addresses

                                                                                                          We are using Zoho Mail and needs to whitelist IP for some redirections from your service to another e-mails. You can provide IP address list for Zohomail SMTP servers?
                                                                                                        • Migrate Your Notes from OneNote to Zoho Notebook Today

                                                                                                          Greetings Notebook Users, We’re excited to introduce a powerful new feature that lets you migrate your notes from Microsoft OneNote to Zoho Notebook—making your transition faster and more seamless than ever. ✨ What’s New One-click migration: Easily import
                                                                                                        • Deluge sendmail in Zoho Desk schedule can't send email from a verified email address

                                                                                                          I am trying to add a scheduled action with ZDesk using a Deluge function that sends a weekly email to specific ticket client contacts I've already verified the email address for use in ZDesk, but sendmail won't allow it in its "from:" clause. I've attached
                                                                                                        • Zoho Campaigns - Why do contacts have owners?

                                                                                                          When searching for contacts in Zoho Campaigns I am sometimes caught out when I don't select the filter option "Inactive users". So it appears that I have some contacts missing, until I realise that I need to select that option. Campaigns Support have
                                                                                                        • One Contact with Multiple Accounts with Portal enabled

                                                                                                          I have a contact that manages different accounts, so he needs to see the invoices of all the companies he manage in Portal but I found it not possible.. any idea? I tried to set different customers with the same email contact with the portal enabled and
                                                                                                        • End Date in Zoho Bookings

                                                                                                          When I give my appointments a 30 minutes time I would expect the software not to even show the End Time.  But it actually makes the user pick an End Time.  Did I just miss a setting?  
                                                                                                        • Zoho Commerce

                                                                                                          Hi, I have zoho one and use Zoho Books. I am very interested in Zoho Commerce , especially with how all is integrated but have a question. I do not want my store to show prices for customers that are not log in. Is there a way to hide the prices if not
                                                                                                        • email forwarding not working

                                                                                                          Your email forwarding service does not work. I received the confirmation email and completed the confirmation, after that nothing and nothing since no matter what I have tried. Shame as everything else was smooth. I spose it's harder to run one of these web based internet mail services than you guys thought!!! can you fix the email forwarding asap PLEASE!
                                                                                                        • Google Ads Conversions Not Being Tracked in Zoho CRM

                                                                                                          We have 3 different conversions created in our Google Ads Account. Only one of the 3 conversion types is tracking in Zoho CRM. Our forms are Elementor Forms that are mapped into Zoho CRM. It apprears to me that all leads are showing up in Zoho CRM, but
                                                                                                        • Zoho Desk KB article embedded on another site.

                                                                                                          We embed KB articles from Zoho Desk on another site (our application). When opening the article in a new tab, there is no issue, but if we choose lightbox, we are getting an error "To protect your security, help.ourdomain.com will not allow Firefox to
                                                                                                        • Enable Locations for Expense

                                                                                                          Hi, please enable Locations (ex Branches) for Zoho Expense so that there is consistency between this app and Zoho Books. Thanks in advance.
                                                                                                        • Currency abbreviations

                                                                                                          Hello, Im stuck, and need help. I need the currency fields for example, opportunity value, or total revenue, to be abbreviated, lets say for 1,000 - 1K, 1,000,000 - 1M, and so on, how should I do this?
                                                                                                        • Losing description after merging tickets

                                                                                                          Hello, We merge tickets when they are about the same topic from the same client. It happens sometimes. We recently noticed that after the merger only the description from the master ticket is left in a thread. And the slave-ticket description is erased.
                                                                                                        • in the Zoho Creator i have File Upload field get the file on submission of the form Get the File and upload to Zoho Books

                                                                                                          in the Zoho Creator i have File Upload field get the file on submission of the form Get the File and upload to Zoho Books . how I get the file From zoho creator and upload to Zoho Books . using Api response = invokeUrl [ url: "https://www.zohoapis.com/creator/v2.1/data/hh/l130/report/All_Customer_Payments/"+input.ID
                                                                                                        • Generate a link for Zoho Sign we can copy and use in a separate email

                                                                                                          Please consider adding functionality that would all a user to copy a reminder link so that we can include it in a personalized email instead of sending a Zoho reminder. Or, allow us to customize the reminder email. Use Case: We have clients we need to
                                                                                                        • Syntax for URLs in HTML Snippets

                                                                                                          What are some best practices for inserting a URL in an HTML snippet? I've looked at Zoho Help articles on navigation-based and functional-based URLs, but I'm still unclear on how to incorporate them in an HTML snippet. For example, 1. How do I link to
                                                                                                        • Rate Limiting in Zoho Flow (OpenAI API)

                                                                                                          Hi Everyone, We are facing some issues when using Zoho Flow as we have a deluge script running which is making external calls to OpenAI endpoint. Sometimes the response takes more than 30 seconds meaning the script will timeout. We want to implement a
                                                                                                        • Placing a condition before converting the LEAD

                                                                                                          Hi,  I need some assistance with Lead conversion. I need to place certain conditions before allowing the user to convert the lead.  For example: up until the certain status's doesn't equal "green" don't allow to convert lead.  I tried creating this using
                                                                                                        • it is possible to open a widget via deluge script function

                                                                                                          I have one function that is workflow action I call my fucntion I need to call the internal widget it is possible to open or it have to please tell me the solution
                                                                                                        • Next Page