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

    • 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'));
    • Free user licenses across all Portal user types

      Greetings everyone, We're here with some exciting and extensive changes to the availability of free user licenses in CRM Portals. This update provides users with access to all Portal user types for free to help them diversify their user licenses and explore
    • 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
    • Directly Edit, Filter, and Sort Subforms on the Details Page

      Hello everyone, As you know, subforms allow you to associate multiple line items with a single record, greatly enhancing your data organization. For example, a sales order subform neatly lists all products, their quantities, amounts, and other relevant
    • 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
    • Custom "Filter By" in Client Portal

      Currently our client portal only shows items for that specific person that is logged on to the portal, we want the current logged user to see all items for that user's company. An example would be invoices, so the current user would see all invoices for
    • Easy way to delete attachments

      I've reached my data limit and would like to run a view/report, and mass delete attachments. Is there an easy, fast way to do this? Moderation Update: Post Summary: There are two features the post discusses a) Easy way to remove Email attachments Will
    • 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
    • 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:" +
    • Webhook when estimate is refused is not firing

      Hello, I use a workflow through make that sends estimate with zoho books (I paid books and sign). -Those estimates when accepted are firing the webhook that I create in zoho sign (photo 1) -However when refused they are not firing the webhook that I created
    • 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 ';'
    • Error 403: Forbidden When Updating Email Signature via API

      Hi Zoho Desk team, First, congratulations again on the excellent Zoho API. But, I’m encountering an issue while attempting to update an email signature via the API. Whenever I make a request to update the signature, the response returns an HTTP 403 Forbidden
    • 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?
    • How do i remove the Powered by Zoho logo from my careers page

      Can I remove this? ​
    • 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
    • Canvas View in Zoho Recruit

      Is it possible or would it be possible to have the new 'Canvas View' in Zoho Recruit?
    • 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,
    • Possible to backdate Stage shifts in Deals module?

      I want to enter my organisation's historical dealflow data into the CRM and it's important that the Stage history is showing the correct dates in the past of when it happened. Is there a way for me to modify the "Modified Time" in the Stage History Related
    • 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
    • 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
    • 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
    • How to easy change layout in existing records in Deals?

      Hello, So far i have used only 1 layout in Deals. I have about 1000 records. Now i want to make new layout. So i have 2 layouts: Layout Old (1000 records) Layout New (0 records) How to easy change layout from Layout Old into Layout New for existing records?
    • 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
    • Merge tickets

      Hello, I am attempting to merge two tickets; however, the option to merge does not appear to be available. Could you kindly confirm if this feature has been relocated or removed? Additionally, could you please provide guidance on the correct process to
    • 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
    • Real Estate CRM

      How can I tailor my CRM for real estate? I had seen an image where the CRM included property tabs.
    • Totals on Pivot Table

      Is there a way to change the way the subtotal calculates? In this example I have a formula to give me the average monthly attendance ....but I want the grand total of the month to be the sum of all the average attendances...any ideas? Thank you!@
    • 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
    • Issue with Bulk Edit Triggering Function Multiple Times in Zoho Report

      In our Zoho report, we have observed an issue where executing a function during a bulk edit operation runs the function multiple times—once for each selected report entry. This behavior is causing errors due to overlapping or redundant executions. Our
    • Next Page