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();
      // 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
      // construct parameter for filter only open bugs
      milestoneList = list();
      bugParam = Map();
      info "bugParam:" + bugParam;
      //Add your connection name as last parameter
      bugResponse = zoho.projects.getRecords(portalId,projectId,"bugs",bugParam,1,"zpmsautocomplete");
      info bugResponse;
      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();
      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
      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

                  Zoho Marketing Automation

                    Zoho SalesIQ Resources

                          • Sticky Posts

                          • Gallery Function for Updating Project Status

                            A custom function is a software code that can be used to automate a process.  Gallery functions are a set of pre-defined custom functions in Zoho Projects. Users can automate these functions by establishing a Connection and by associating it with a Workflow.
                          • Tip 37: Time Log Restriction in Zoho Projects

                            Timesheet in Zoho Projects helps you big time in entering log hours for the tasks and issues and approving them. Now, with the new Time Log Restriction option, you can set daily and weekly log hour limits. You can restrict users from entering extra log hours than the permissible limit. The limits are restricted to 24 hours per day and 168 hours per week by default based on business hours. To customize, navigate to Task & Timesheet settings under Portal Configuration in Zoho Projects setup and enable
                          • Tip 42: Create multiple layouts for projects

                            Every project you create has a unique strategy, goals, and functional requirements. To keep your projects on track, it is important to plan your project by defining the scope and requirements, specifying the deliverables, and setting deadlines. In order to do so, project layouts are extremely helpful in establishing your project plans and in capturing specific project details. With Zoho Projects, you can create multiple layouts to capture the unique details of every project.    You can create project
                          • 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.
                          • Profiles - Comment Edit/ Delete Permissions

                            Posting comments under a task, a milestone, or any other module is an important way to collaborate with your team members. You can now set permissions in Zoho Projects to have more control over the module's comment section. For instance, if you want to

                          Manage your brands on social media

                            Zoho Pagesense Resources

                                  Zoho TeamInbox Resources

                                    Zoho DataPrep Resources

                                      Zoho CRM Plus Resources

                                        Zoho Books Resources

                                          Zoho Subscriptions Resources

                                            Zoho Desk Resources

                                              Zoho Projects Resources

                                                Zoho Sprints Resources

                                                  Qntrl Resources

                                                    Zoho Creator Resources

                                                      Zoho WorkDrive Resources

                                                        Zoho Campaigns Resources

                                                          Zoho CRM Resources

                                                          • CRM Community Learning Series

                                                            CRM Community Learning Series

                                                          • Tips


                                                          • Functions


                                                          • Meetups


                                                          • Kbase


                                                          • Resources


                                                          • Digest


                                                          • CRM Marketplace

                                                            CRM Marketplace

                                                          • MVP Corner

                                                            MVP Corner

                                                          • Word of the Day

                                                            Word of the Day

                                                                Design. Discuss. Deliver.

                                                                Create visually engaging stories with Zoho Show.

                                                                Get Started Now