Power of Automation :: Automatically update the Project status based on the Milestone status

Power of Automation :: Automatically update the Project status based on the Milestone status


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:


When the status of the first milestone is updated to ‘complete’ the status of the respective project should be automatically updated to ‘In Progress’. Likewise, once the status of the last milestone is set to ‘complete’ then that project status should be automatically updated to ‘Completed’.


We had accomplished this requirement using Custom functions.


Create a connection for Zoho Projects service with the scopes “ZohoProjects.Portals.ALL, ZohoProjects.projects.ALL, ZohoProjects.Milestones.ALL, ZohoProjects.tasks.Read” to replace ‘connectionprojects’ with the connection name. Click this link below to learn how to create the connection. Attached the screenshot of the Arguments.


Script to be used


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

endPoint = "https://projects.zoho.com/restapi/portal/";

// Get Task Details

taskResponse = zoho.projects.getRecordById(portalId,projectId,"Tasks",taskId,"connectionprojects");

milestoneId = taskResponse.get("tasks").get(0).get("milestone_id");

// Get Milestone Details

milestoneResponse = zoho.projects.getRecordById(portalId,projectId,"milestones",milestoneId,"connectionprojects");

milestoneStatusName = milestoneResponse.get("milestones").get(0).get("status_det").get("name");

if(milestoneStatusName.containsIgnoreCase("Completed"))

{

getProjectDetails = invokeurl

[

url :endPoint + portalId + "/projects/" + projectId + "/"

type :GET

connection:"connectionprojects"

];

projectStatus = getProjectDetails.get("projects").get(0).get("status");

projectlayoutId = getProjectDetails.get("projects").get(0).get("layout_details").get("project").get("id");

if(projectStatus.containsIgnoreCase("ACTIVE")){

statusName = "in progress";

getProjectLayoutDetails = invokeurl

[

url :endPoint + portalId + "/module/projects/layouts/" + projectlayoutId + "/?module=Projects&moduleId=0"

type :GET

connection:"connectionprojects"

];

customStatus = getProjectLayoutDetails.get("customstatus");

for each  status in customStatus

{

if(status.get("status_name").containsIgnoreCase(statusName))

{

statusId = status.get("status_id");

break;

}

}

projectsParameter = Map();

projectsParameter.put("custom_status",statusId);

updateProjectResponse = invokeurl

[

url :endPoint + portalId + "/projects/" + projectId + "/"

type :POST

parameters:projectsParameter

connection:"connectionprojects"

];

}

milestoneParameter = Map();

milestoneParameter.put("index",0);

milestoneParameter.put("range",25);

getMilestoneDetails = invokeurl

[

url :endPointV3 + portalId + "/projects/" + projectId + "/milestones/view"

type :GET

parameters:milestoneParameter

connection:"connectionprojects"

];

views = getMilestoneDetails.get("customview_list").get("default_views");

for each  view in views

{

if(view.get("name").containsIgnoreCase("allopen"))

{

viewId = view.get("custom_view_id");

break;

}

}

viewMilestoneDetails = invokeurl

[

url :endPointV3 + portalId + "/projects/" + projectId + "/milestones/viewscount/" + viewId

type :GET

connection:"connectionprojects"

];

if(viewMilestoneDetails.get("view_count") == 0)

{

statusName = "Completed";

getProjectDetails = invokeurl

[

url :endPoint + portalId + "/projects/" + projectId + "/"

type :GET

connection:"connectionprojects"

];

projectlayoutId = getProjectDetails.get("projects").get(0).get("layout_details").get("project").get("id");

getProjectLayoutDetails = invokeurl

[

url :endPoint + portalId + "/module/projects/layouts/" + projectlayoutId + "/?module=Projects&moduleId=0"

type :GET

connection:"connectionprojects"

];

customStatus = getProjectLayoutDetails.get("customstatus");

for each  status in customStatus

{

if(status.get("status_name").containsIgnoreCase(statusName))

{

statusId = status.get("status_id");

}

}

projectsParameter = Map();

projectsParameter.put("custom_status",statusId);

updateProjectResponse = invokeurl

[

url :endPoint + portalId + "/projects/" + projectId + "/"

type :POST

parameters:projectsParameter

connection:"connectionprojects"

];

}

}

return "success";


To automate this, we can configure a workflow rule with the trigger as updating the task status and criteria should be set as task status is closed then associate the custom function.


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. 


    Access your files securely from anywhere

          Zoho Developer Community




                                    Zoho Desk Resources

                                    • Desk Community Learning Series


                                    • Digest


                                    • Functions


                                    • Meetups


                                    • Kbase


                                    • Resources


                                    • Glossary


                                    • Desk Marketplace


                                    • MVP Corner


                                    • Word of the Day



                                        Zoho Marketing Automation
                                                • Sticky Posts

                                                • Zoho Projects Roadshow, USA - 2024

                                                  Dear Users, We are happy to announce the Zoho Projects Roadshows 2024 in USA. This is an excellent opportunity to learn more about Zoho Projects and gain in-depth knowledge of the advanced features. Our team will also discuss industry specific solutions
                                                • Project Billing with the Staff Hours Method in Zoho Projects

                                                  The Staff Hours Billing Method in Zoho Projects allows you to bill your clients based on the actual time spent by each team member on a project, at the rate set for each user. This is useful for projects where different skill sets are needed and service
                                                • 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
                                                • Organize and Track Phases with Phase Custom Views

                                                  Phase Custom Views let you filter and display phases based on specific criteria. This helps you focus on what’s most relevant for you and your team. Filter phases using criteria such as budget, status, and more. Share views with specific users or teams
                                                • Create Your Own Issue Management System

                                                  Effective issue management is a cornerstone of project success. Every bug or issue, no matter how small, needs to be tracked and resolved in time to maintain project momentum. In this post, we’ll explore how an issue management system in Zoho Projects


                                                Manage your brands on social media



                                                      Zoho TeamInbox Resources

                                                        Zoho DataPrep Resources



                                                          Zoho CRM Plus Resources

                                                            Zoho Books Resources


                                                              Zoho Subscriptions Resources

                                                                Zoho Projects Resources


                                                                  Zoho Sprints Resources


                                                                    Qntrl Resources


                                                                      Zoho Creator Resources



                                                                          Zoho Campaigns 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

                                                                                                  • Bigin iOS, macOS and Android app update - File Cabinet

                                                                                                    Hello Everyone! In the most recent iOS (v1.7.1) and macOS (v1.5.1) updates of the Bigin app, we have included support for the File Cabinet functionality. You can access this feature as a topping within the web app (bigin.zoho.com) and conveniently use
                                                                                                  • Power of Automation :: Automatically close the associated tasks once the Issues are closed

                                                                                                    Hello Everyone, A Custom Function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as to when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. We have
                                                                                                  • Meeting vs Zoom and why we are moving

                                                                                                    Dear Meeting team,                                   I want to share my thoughts on Meeting vs Zoom and explain why we are moving back to Zoom for all our video conferencing, even though it is part of our Zoho One Subscription. 1). Video & Audio quality - We see a significant downgrade in video quality when using Meeting vs Zoom, even when using the same internet connections.  Meeting video is blurry and not sharp compared to Zoom.  Audio is also hit and miss on Meeting with frequent drop outs and
                                                                                                  • booking link that expires

                                                                                                    I have a suggestion that is  crucial. When i send booking URL to clients they keep the link and they book appointment whenever they want multiple times. You should give us the Booking URL feature. We should be able to send it and the user can use it only
                                                                                                  • Accessing Subform Data using getRecordByID

                                                                                                    I am getting data from Zoho Creator using deluge zoho.creator.getRecordByID task, from another application. The report contains a subform, and that subform is in the detail view of the report. I do not appear to have any subform data in the JSON response,
                                                                                                  • Print record summary to pdf page breaks

                                                                                                    Hello. I created a record summary and would like to export to pdf. Rich text fields or photos can get printed on 2 pages cutting them in half. Is there a way to add page breaks? Thanks.
                                                                                                  • The email address you have entered belongs to a different deployment/region.

                                                                                                    Hi, I am trying to create the user - mprust@crombiecomputers.co.uk but keep getting the message below -  The email address you have entered belongs to a different deployment/region. Please contact support@zohoaccounts.com for assistance. Look forward
                                                                                                  • Pre-fill TO and CC fields for Email Templates

                                                                                                    This would be a game changer to be able to set either specific email addresses or merge fields based on deal role titles into email templates. Please pass this along to *hopefully* add to future features of Zoho CRM.
                                                                                                  • Leads and Deals Issue

                                                                                                    Hi! Is Zoho having trouble today? I've been experiencing issues today. When I move a deal to closed/won, it previously would require a closing date but today the screen just went blur and the closing date did not pop up. And then under leads, I was trying
                                                                                                  • QR codes in templates

                                                                                                    I'm excited about the new QR code generator. I have included a QR code that contains the record ID setting "${ID}" as input data. In the report detail it works perfectly but when printing it in a template the code is not shown.
                                                                                                  • How do I hide all leads from Standard users in my CRM ZOHO

                                                                                                    I want to configure my crm zoho in such a way that standard users will only see leads owned or assigned to them. How do I go about doing this? I have tried all i could, but nothing...can anyone help me?
                                                                                                  • How to Implement Time-Based Filters in Zoho Workflows?

                                                                                                    Hi everyone, I’m looking for a workaround to implement time-based filters in Zoho workflows. Specifically, I need a workflow to trigger only within certain hours (e.g., between 10:00 AM and 8:00 PM, Sunday to Friday). Currently, Zoho workflows execute
                                                                                                  • is there a better way to routinely export my project timesheets?

                                                                                                    Hi there, I am somewhat happy with how Zoho books handles time.  One thing that is missing is more user driven control over my data.  I have a workflow where I constantly need to give customers feeds of work done.  So I pick a project, and would ideally
                                                                                                  • Portal Default View

                                                                                                    Hello! My company is about roll out portals for some users, but we were wondering if it was possible to set the Record Detail Page View to default to a custom view that we made. That way the information they need would be streamlined and easier to see.
                                                                                                  • Does zoho rest api support token exchange from microsoft entra id token

                                                                                                    i want to get access token from the Microsoft user token in rest api. so it is possible to exchange microsoft user access token to zoho's access token or auth token ( token should be user specific not super admin).
                                                                                                  • Important: DKIM verification needed for unauthenticated email domains

                                                                                                    Hi all, This post is to inform users who are currently using unauthenticated email domains as their sender email for their notifications. We have mandated DKIM verification for all domains used as sender email addresses for the outgoing emails by 01-Feb-2025
                                                                                                  • How do I define a weekend

                                                                                                    I noticed the default for weekends does not seem to include Saturdays. How can i define weekends to include both Saturdays and Sundays? Thank you.
                                                                                                  • Zoho Sign Product updates - H2 2024

                                                                                                    Hello! We have almost come to the end of 2024! Here's a list of features and enhancements that went live in the later half of the year. NOM 151 certification Witness signing Formula, conditional, and custom fields Zoho Sign's extension for Bigin by Zoho
                                                                                                  • Custom Status for Purchase Orders

                                                                                                    Currently Zoho books has functionality to create custom statuses for Sales Orders. Can this be extended to include custom status for purchase orders as well? It was a great decision to add this functionality to sales orders. Our use case is for tracking
                                                                                                  • Remove Address from credit card payment

                                                                                                    I would like to remove the need to add address when paying by credit card. I only want the customer to have to add their credit card details.
                                                                                                  • Top Menu Disappeared from Blog Page

                                                                                                    Hi, Our top menu disappeared at Blog Posts page. However, it's still visible any other page on the website. I attached two screenshots, so it can be understood clearly. How can we bring back top menu? Thanks, K.
                                                                                                  • New Built In QR/Barcode Generator Print Settings

                                                                                                    I'm trying out the new QR/Barcode generator field in Creator. I would think most people will want to print these, like I do. I am not seeing any way to control the height or width of the barcode for printing (inside the print/pdf template builder). The
                                                                                                  • My Zoho mail has been blocked for suspicious activity. cannot unblock it! need urgent help!

                                                                                                    Hi, I was accessing my email on an airplane which for some reason resulted in my mail being blocked. I have managed to unblock my incoming however outgoing is still blocked. I have contacted all your support emails but it still says contact support when I try to unblock outgoing emails. Its now been over 8 days with the same issue which is really serious as I'm not able to send several business emails during this period. I have followed all your steps to unblock this and contacted your support 5
                                                                                                  • Copy Widget to another Dashboard

                                                                                                    I can see the option to clone a widget to the same dashboard but is it possible to copy it to another dashboard?
                                                                                                  • Error while importing products Purchase Price: Value in the field does not match with the data type supported by us.

                                                                                                    I am trying to import items into zoho inventory using an excel spreadsheet. I keep getting this error Purchase Price: Value in the field does not match with the data type supported by us. no matter how i format the cells this comes up and will not import
                                                                                                  • Quotes Module - import data

                                                                                                    Hello Zoho, is it possible to import Quotes records? I was trying and i have no results. Raport shows no data imported. Could you help me please how to do it?
                                                                                                  • Year-End Wrap: Disconnect now; Reconnect later with Offline Mode

                                                                                                    🎄Happy Holidays🎄 Let's say you are travelling home to spend the holiday season with your loved ones. Before you even board the train, you check your phone only to find your inbox rapidly filling with urgent emails that need your attention. There’s no
                                                                                                  • Resource booking functionality questions

                                                                                                    I'm exploring the resource booking functionality in Zoho Bookings for my organisation's needs. I have a few questions about the available Zoho Bookings functionalities. Is it possible to force all users to sign up for an account before they book a resource?
                                                                                                  • How to create a Field with answers as Yes, No> Further if no is selected a new field to be visible to give details

                                                                                                    Dear All, I am creating a feedback form in HR Letter. The question is were you satisfied with the work allotted. Expected answer to this is Yes, No. Further if the response is no, then a field to be give to fill more details as to why no was selected.
                                                                                                  • Modify the way a phone number is shown in footer on ZOHO Booking Page

                                                                                                    The default display of the phone number field in the footer is not customer friendly - See image below. We would like it to use the accepted standards of phone number display: +61 (0)2 88545440, or allow us to choose. At the moment ZOHO Booking sets how
                                                                                                  • Zoho Bookings Multilingual ?

                                                                                                    Hello, Not sure if there is a way to do it currently, but it would be very helpful if Zoho bookings allowed multilingual translations so we could have our booking pages and notifications setup in multiple languages. Thanks,
                                                                                                  • Allow customers to choose meeting venue and meeting duration on booking page

                                                                                                    My business primarily involves one-to-one meetings with my clients. Given the hybrid-work world we now find ourselves in, these meetings can take several forms (which I think of as the meeting "venue"): In-person Zoom Phone call I currently handle these
                                                                                                  • Two way sync Zoho Mail and Bookings

                                                                                                    Hi, I know it’s possible to view Bookings appointments in Zoho Mail, but is there a way to see my Zoho Mail meetings in the Bookings calendar?
                                                                                                  • Modifying iframe data of Zoho booking iframe

                                                                                                    Hello, I have integrated a Zoho Bookings embedded iframe into my website. Currently, I am pre-filling the booking form with default values as part of our process flow. However, I want to ensure that if an input field is already populated with a default
                                                                                                  • Sending my emails to Spam Folder

                                                                                                    I am loosing my business because of this issue, many of my customers are receiving their email in the spam sometimes no one checks them
                                                                                                  • Why can't I sync my Zoho Mail tasks and notes with my mobile device, and is there a way to fix this issue?

                                                                                                    I'm having trouble syncing my Zoho Mail tasks and notes with my mobile device. Despite following the usual steps, the tasks and notes don't appear on my phone. Is there a way to fix this issue? Regards, Adamjes, Tekskills India Pvt Limited, India.
                                                                                                  • Re: constant rejected email form and to my account

                                                                                                    Hi, have had several rejection when I sent an email to Zoho account as well as other people have sent emails to my as your health Centre they have account and all aspects have been ejected. i wonder why the email are rejecting to and from. If you see
                                                                                                  • How do I redeem credits?

                                                                                                    How do I redeem credits that are shown in billing section?
                                                                                                  • Cannot add IMAP account to "new" Outlook

                                                                                                    Hi, I am attempting to add an IMAP account to my copy of the "new" Outlook on my desktop computer. I have tried using the default password when MFA was disabled and an app password when MFA was enabled. But neither attempt worked. My Windows 11 OS number
                                                                                                  • Update Zoho Flow on Sprint Work Item Status Change

                                                                                                    Hello, I've contacted Zoho One support but have been unable to help in a timely manner, so I'm asking the community. I want to start using sprints, but I'm having an issue. I need to post updates to Slack when a Work Item has a status change. My understanding
                                                                                                  • Next Page