Creating roll ups on custom_fields

Creating roll ups on custom_fields

portalId = 60XXXXXX;
// projectId = 19063XXXXXXX;
// taskid = 19063XXXXXXX;
response = zoho.projects.getRecordById(portalId,projectId,"tasks",taskid,"bs");
// info response;
tasks = response.get("tasks").get(0);
info tasks.get("id");
p_task_id = tasks.get("parent_task_id");
info "task_parent" + p_task_id;
custom_fields = tasks.get("custom_fields");
for each  custom_field in custom_fields
{
if(custom_field.get("label_name") == "Actual_Cost")
{
task_amount_act = ifnull(custom_field.get("value").toDecimal(),0);
// Convert value to decimal
// actual_cost_l1 = actual_cost_l1 + task_actual_cost;
info "task_amount_act >>" + task_amount_act;
}
}
p_task_res = zoho.projects.getRecordById(portalId,projectId,"tasks",p_task_id,"bs");
tasks_p = p_task_res.get("tasks").get(0);
tasks_p_id = tasks_p.get("id");
info "P_t_id :" + tasks_p_id;
custom_fields_p = tasks_p.get("custom_fields");
for each  custom_field in custom_fields_p
{
if(custom_field.get("label_name") == "Actual_Cost")
{
task_actual_cost = ifnull(custom_field.get("value").toDecimal(),0);
// Convert value to decimal
// actual_cost_l1 = actual_cost_l1 + task_actual_cost;
info "task_actual_cost >>" + task_actual_cost;
}
}
total_sum_st_l1 = task_actual_cost + task_amount_act;
total_sum_dis = total_sum_st_l1.toLong();
info "total_sum_st_l1>>" + total_sum_dis;
task_details = Map();
ts = Map();
ts.put("UDF_LONG10",total_sum_dis);
task_details.put("custom_fields",ts);
res = zoho.projects.update(portalId,projectId,"tasks",tasks_p_id,task_details,"bs");
info "res >>" + res;
return "";

This script is designed to aggregate the value of a custom field (e.g., "Actual Cost") from a subtask and add it to the corresponding custom field of its parent task. The workflow can be extended by implementing a rule that triggers this script whenever the subtask's custom field is updated.

Key Considerations:

  • Single Update Application: This script is intended for scenarios where the custom field value is updated once. If the field is subject to frequent updates, additional logic may be required to ensure accurate aggregation.
  • Custom Field Handling: When updating values in custom fields, it is crucial to verify the field type and format the input accordingly. You can determine the field type by inspecting the task's page.

Code Workflow:

  1. Retrieve Subtask Details:

    • Fetches the subtask details using getRecordById.
    • Extracts the custom field value for "Actual Cost."
  2. Retrieve Parent Task Details:

    • Fetches the parent task details using getRecordById.
    • Extracts the custom field value for "Actual Cost."
  3. Calculate Total Cost:

    • Sums the "Actual Cost" values from the subtask and the parent task.
  4. Update Parent Task:

    • Updates the parent task's custom field with the aggregated cost.

This script provides a foundational approach, allowing you to tailor the logic according to your specific requirements.

    • Sticky Posts

    • Tip of the Week: Task Sorting

      I believe that sorting of tasks helps managing the activities in a better fashion. You might second it too . By default, the tasks are listed chronologically. However, you can sort the tasks either by its title, start date, end date, priority, created by and percentage completion. All you have to do is, click the Task Sorting option and select the required criteria. Few points to be noted about task sorting: This option is available in the Classic View only (within My Tasks, Tasks & Milestones section).
    • Tip # 3 - Follow And Add Followers To Your Project Modules

      Besides owning effective managers and quick-witted employees, you need to have supportive followers for accomplishing your project goals. Accompanying this note, today, lets run through a quick and easy tip on  'How to follow and add followers to your project activities?' . Follow the project activities all by yourself -Follow to get real-time milestone updates Milestones are nothing but your project goals, which can ultimately uplift your projects' quality to the next level. Now, users in the portal
    • Tip of the Week: Task Dependency (Duration in Hours)

      I hope the tip on task dependency helped in understanding how it works in Zoho Projects. In a real-time, the successor task may or may not start on the predecessor's completion date. On either case, a project management tool should allow the users to set dependency between tasks. Ain't it? In Zoho Projects, the Task Duration in Hours option allows the users to set dependency between tasks that ends and starts on the same day. The Portal Owner and Admin role users can activate this option from the
    • Tip of the Week: Task Dependency

      Task Dependency - a feature that allows the users to establish dependency / linking between tasks within the project. Points to be noted with respect to this feature: Task Dependency can be set only from the Dependency View section within the Tasks & Milestones module Tasks setup with duration (start & end date) will only be displayed in the Dependency View The supported dependency model is Finish to Start Dependency can be established only between the tasks in the same project A task can be dependent
    • Tip of the Week: Drag and Drop option in Calendar

      As the thoughts flow in your mind, you plan the tasks, provide duration and assign users. While you go through the calendar later, you feel that a couple of tasks should needs to be postponed by a couple of days. Do you navigate to the Tasks & Milestones section and change the task duration? is the question I have for you. In case of YES, I would say that the task duration can be changed from the Calendar module itself. All you need to do is: Drag the task bar and Drop it on the required date. Note:
    • Recent Topics

    • Integrating Quotes with leads Information

      Our business requires giving a quote to a lead (not Account / Potential - as we define it differently). Currently, Zoho CRM's Quotes are integrated with Accounts / Potentials and not with Leads. Is there a way I could get the Lead information to the Quotes
    • Unknown error occurred

      Hi, When we want to publish or edit a page in our website, we encounter with "Unknown error occurred" problem. I share a screenshot here. Our website is www.essoft.com. It happens every page. We want to solve this ASAP.
    • Zoho one

      I am starting Zoho one as a beginner and there is Zoho crm and Zoho sales which i needed to work on but it appears in unassigned apps. What Should i do now?
    • Dialing Microsoft Teams Phone Service via Zoho CRM

      I am using the VOIP option in Microsoft teams for my office phone system. I was hoping to have a way to dial numbers directly from Zoho CRM, but don't see anything in the Teams Integration or in the Telephony integration that will enable this. Does anyone
    • Emailing lookup field but placing this as an ID or number rather than text

      Hi there, First time poster and have been a user of Zoho Creator for approx 6weeks so forgive my ignorance as I learn to code. We have a need to send an email to a specific email address with some of the fields triggered by the submission of a form. In
    • Search mails in shared mailbox

      Hi everyone, is there a way to search mails in shared mailbox's? Search in streams or mail doesn't return anything from mails in shared mailboxes. Thanks! Rafal
    • User Emails Blocked

      Community: I keep running into issues where our users stop receiving notifications from CRM because their email addresses get blocked in on the backend some how. I reach out to support, they confirm, they fix, and we carry on, but then it happens again.
    • Why wont Zoho Support Grammarly!! --- PLEASE VOTE FOR THIS to show Zoho we need this

      The spell check and grammar in ZOHO are so buggy and a waste of time. Please support Grammarly! I'm sure I'm not the only one — there are other CRMs that support this. If you're not planning to add this feature, Please let others know before accepting
    • Is it possible to hide Developer Space for all user in Zoho Projects

      Hello! I am Zoho admin in a company and we want to use Zoho Project to manage projects, but after a few days of testing we are not able to "hide" the Developer Space from all kind of users except the admin. To sum up, I want to hide this for all users.
    • API (v2) Search Criteria using CONCAT

      With API I can search for a contact using First_Name and Last_Name. However, when I need to search the Contact Module using a full name — and because CRM does not provide an API for full name — I am not finding a way to do this in the traditional way
    • Weekly Tips: Stay Focused with Email Snooze!

      New Year, New Resolutions Being back at work also means being back to the constant barrage of messages from work and clients. The constant flood of incoming emails can lead to the missing of important messages, especially when you can't respond right
    • Schedule Zoho CRM reports only on Business Days

      Hello, Is it possible to schedule reports only on business days ? We currently get daily sales reports on weekend which has no value since the sales team doesn't work on weekends. Thanks
    • Zoho Payroll's Year in Review 2024

      As we roll into 2025, we'd like to pay tribute to all the milestones we hit in 2024! From releasing out new features that streamlined your workflows to updates that made payroll management smoother, we’ve had a prolific year—all while keeping you, our
    • Recurring Events Not Appearing in "My Events" and therefore not syncing with Google Apps

      We use the Google Sync functionality for our events, and it appears to have been working fine except: I've created a set of recurring events that I noticed were missing from my Google Apps calendar. Upon further research, it appears this is occurring
    • Multiplying Weight of product by Quantity

      I am facing an issue with creating a report that consolidates the total sales volume in kilograms. I have already specified the weight for each product. I have also aggregated the total sales quantity. The key question is: how can I create a report that
    • Confirmation prompt before a custom button action is triggered

      Have you ever created a custom button and just hoped that you/your users are prompted first to confirm the action? Well, Zoho knows this concept. For example, in blueprint, whenever we want to advance to the next state by clicking the transition, it is
    • Frontal interview scheduling - room availability in office using Google Workspace?

      Hi, We're using Zoho Recruit as our ATS and Google Workspace as our email, calendar and resources management. We want to use the interview feature to schedule an in-person (frontal) interview with the applicants. How can we sync the room resources availability
    • Add and Remove Agents from Departments and Groups in Zoho One

      Hi Zoho Flow Team, We hope you're doing well. Currently, Zoho Flow provides an action to add an agent to a group in zoho one, but there is no action to remove an agent from a group or a department. Another action that we find missing is the option to
    • Explication sur comment mettre en place des règles d'affichage ou "layout Rules"

      J'ai passé plus d'une heure hier avec le support et je n'ai rien compris !! Je suis lecteur assidu des guides (je "RTFM") qui ne sont absolument pas orienté "client" chez Zoho, et je tiens à le rappeler ici . Dans la documentation on m'indique un cas
    • Introducing Hiring Pipeline for Vendor Portal

      Keeping vendors informed about candidate progress is often challenging, leading to communication gaps and repeated follow-ups. To address this issue, we've released an update to the Vendor Portal feature that lets you choose to display candidates' hiring
    • Address Grabber function for Zoho

      I converted from ACT to Zoho. With ACT, I used an add-on called AddressGrabber to scrape the contact information from leads that I buy and contact information contained on emails and websites and directly add it as a new lead or contact. Does anyone know
    • Integrate zoom with zoho bookings please; or add optional times in zoho meetings

      Just like events - these online meetings like zoom need to be integrated with zoho bookings, and there needs to be option for customer to book a time slot. It should not be dictated by CRM user.
    • Add Owner to deluge-created module record note

      Is it possible to include the "owner" aka "creator", of a Note when creating it via delulge? This sets "superadmin" as the Note creator. I need to override it. notemap = Map(); notemap.put("Parent_Id",program_contact_id); notemap.put("Note_Content",program_contact_data.get('Note'));
    • Unique and Random IDs in Zoho Forms: Organize and Secure Your Data Efficiently

      When it comes to form submissions, organizing and identifying entries effectively is crucial. Zoho Forms offers two versatile ID generation options for submissions: Unique ID and Random ID. Each serves distinct purposes, providing flexibility to meet
    • Sort By Date - Deluge

      I have the following code, which normally works to sort calls by created time. Every once in a while, it doesn't work and something sneaks through in the wrong order and I can't figure out why. calls = zoho.crm.searchRecords("Calls","(Owner:equals:" +
    • Need to change author's name in blog post

      My colleague wrote a blog post for our blog but when I put it on our site, the author's name automatically populated as mine. I contacted ZohoSupport and was told to change the Nickname in my profile. Well, I did and then ALL the blog posts were listed as being written by my colleague! Is there any way to simply change one blog post with the correct author's name?
    • Iteration through a list - Coming up against a "Failure to update function" error

      Hi there! I've been attempting to get a deluge script working and am running into an error that I have been unable to resolve. The error I am getting is Failed to update function Error at line :18. Improper Statement. Error might be due to missing ';'
    • Can you modify "Last Activity Time" in deluge? If so what's the field name?

      I need to perform some bulk modifications on records in the Leads module, but I need to avoid changing the "last activity time" or "date modified" because I am using those fields to filter and sort leads for follow-up action. I cannot find an answer anywhere
    • 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 CRM】ポータル機能のアップデート

      ユーザーの皆さま、こんにちは。コミュニティチームの藤澤です。 今回は「Zoho CRM アップデート情報」の中からポータル機能のアップデートをご紹介します。 今回の機能アップデートにより、CRMのポータルへのログインがより簡単にできるようになりました。 【目次】 SAMLベースのシングルサインオンについて ポータルへのアクセスリンク送付について 今回のアップデートにより、アイデンティティプロバイダー(IdP)を利用している組織において、SAMLベースのSSO(シングルサインオン)を有効化できるようになりました!
    • Getting error during inserting a record in form of zoho people using zoho api

      import requests import json # Set your access token and Zoho People API base URL access_token = '1000.XXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXX' api_base_url = 'https://people.zoho.in/people/api/' # Set the form name and data to be inserted form_link_name
    • UI Arabic

      can i change the member portal UI to arabic in zoho community?
    • Resume template to include profile photo

      Hi, We would love the Resume Template to be able to include their profile photo. How can this be done? Miriam
    • Marking a form as 'done'?

      Hi! I've got a form that staff fill in when moving stock from location to location. I see the entries they've sent across and I input them into my stock control system. Is there a way to mark a form as 'done'? So that I know which entries I've input,
    • Zoho CRM - best way to search an account and assign to a deal

      Hi Everyone I am looking for some advice. I want to find the best way to complete the below steps. We have a deal and once it reaches a certain stage we need to allocate a supplier / vendor to this deal along with the salesperson. I want to add (ideally
    • Zoho Rating

      When I close a ticket, the zoho system automatically sends an email to the customer for them to leave a rating. When they leave a rating, the ticket re-opens and I have to close it again. When I close it again, the zoho system sends the customer an email
    • Zoho GC Flow is not showing in IM Channels

      I have added my social IM channels in zoho desk. Created a GC Flow to automate conversations. But Guided conversations are not showing in any platforms I have chosen; WhatsApp Instagram Messenger Web (Business Messaging) In the flow I mentioned these
    • Sharing Knowledge Base articles across multiple departments

      It would be useful to share some Knowledge Base articles across multiple departments where they are applicable, rather than having to go into other departments to find the article you're looking for. For example. Our reception uses the 'Admin' desk whereas our IT guys use the 'Support' desk, however both divisions would find KB articles about our company intranet useful. Reception does not have access to the support desk, so cannot see articles created in the Support KB. Perhaps you could install
    • Contacts marked as Spam are shown as Contacts in tickets.

      Hi Zoho, If a ticket is marked manually as Spam you get an option to set the contact as Spam as well. It would be great if there was another option to delete this Contact. This would be based on the understanding that it wouldn't be marked automatically
    • Is possible to use ${webhookTrigger.payload.street==null?"No street":${webhookTrigger.payload.street}} for to detect inline a null parameter

      Hi Team I need to know if it's possible to evaluate inline the following parameter, with the objetive to detect a null value ? I would like to use ${webhookTrigger.payload.street==null?"No street":${webhookTrigger.payload.street}} Regards, Pablo
    • Next Page