Function #49: Changing Ownership of Multiple Related Records concurrently!

Function #49: Changing Ownership of Multiple Related Records concurrently!



Welcome back everyone!

Last week's function was about tracking refunds and adjusting the sales executive's revenue in Zoho CRM. This week, it's going to be about simultaneously changing the ownership of a record across multiple modules when it is changed in a single module.

Business scenario

Each of us have our strengths and weaknesses. Someone skilled in sales might not necessarily be better in management. It goes to show that in order to successfully run an enterprise, you need an amalgamation of various different talents that work together. Marketing, Sales, Negotiation, Support, Development, etc. All of them have their roles cut out clearly.

As such, lets say there's a guy from the Sales team who takes care of the leads and converting them into deals. Now, that guy has a lot of work to do in converting the lead. Assigning tasks, events, scheduling calls, emails, cases, quotes, purchase orders, etc. He might have to lay the groundwork for the guy who takes care of the negotiation part after the lead is converted. The initial owner of the deal and all the related records with the deal is the Sales guy, but when converted into a deal, shouldn't the ownership change for all of the records? But guess what, changing the deal ownership doesn't change the rest.

But we do have a workaround as you've guessed, since we explained things this far. You can use a function to transfer the ownership for all of the records simultaneously. And this works best when the function is created within a Workflow rule, which can be set to trigger "This rule will be executed when the field Leads Owner is updated to meet the condition(if any)." And there you have it.

Getting started with the function

  1. Go to Setup > Automation > Workflow Rules.
  2. Click '+ Create Rule'.
  3. Select the Module for which this custom function has to be added and give it a name and a description(optional).
  4. Select "On a record action".
  5. Select "Field Update" and Select the checkbox "Repeat this workflow whenever a record is edited".
  6. Select "Deal Owner" and click Next.
  7. Select "All Records" for the Condition.
  8. Choose "Function" from Instant Actions.
  9. Click "+New Function".
  10. Select "Write your own".
  11. Give a name for the function and copy the code given below.
  12. Click On edit Arguments and choose 'Deal ID' and name it as 'dealId' and choose 'Deal Owner ID' and name it as 'dealownerid'
  13. Click on "Save and Associate".
  14. Save the workflow.

The Code

-----------------------------------------------------------------------------------------------------------------------

relatedcases = zoho.crm.getRelatedRecords("Cases", "Deals", input.dealId.toLong());
//info relatedcases;
for each ele in relatedcases
{
update = zoho.crm.update("Cases",ele.get("id"),{"Owner":input.dealownerid});
}

-----------------------------------------------------------------------------------------------------------------------

Note

  • The code given above works only for V2 version of Zoho APIs. Please note that the code WILL NOT work for Version 1.0 APIs.
  • Change the module name in the code from "Cases" to any other module you want.

Found this useful? Try it out and let me know how it works! If you have questions, do not hesitate to ask! Do check out other functions shared in this series here.

See you all next week with another interesting function. Ciao!

    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



                                          Zoho Marketing Automation


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

                                                                                                  • How to add a customized/dynamic Zoho Booking link in email footer?

                                                                                                    We just installed the latest version of the Zoho Desk <=> Zoho Booking extension from the marketplace and are quite happy to see the feature where a ticket-specific appointment booking link can be inserted in a reply. Is there any way to configure this
                                                                                                  • Date Time

                                                                                                    Hi Everyone, I would seek some help about this concern that bugs me. I'm currently working using Zoho Flow to automatically plot a calendar on the Calendar Report. Whenever a ticket from Zoho Desk Field was updated this will trigger to create a plotted
                                                                                                  • Is it possible to load a Module with a filter pre-applied by the URL?

                                                                                                    In many of the CRM related lists, there is limited sorting, and no filtering available. I thought of the idea of putting a Custom Button on a Related List that would take the user to that module, but PRE-FILTERED by the Account from where they were viewing
                                                                                                  • Which WhatsApp API works seamlessly with Zoho CRM?

                                                                                                    I’m exploring WhatsApp API solutions that integrate seamlessly with Zoho CRM for customer communication, lead nurturing, and automation. I would love to hear insights from those who have successfully implemented WhatsApp within Zoho CRM. My Requirements:
                                                                                                  • Crear tarea CRM con recordatorio desde Zoho Flow

                                                                                                    Hola, estoy intentando crear desde Zoho Flow una tarea en CRM. Lo he logrado hacer pero sin recordatorio, ya que no se como se debe escribir el string adecuado. He probado varias alternativas, pero ninguna me funcionó hasta ahora. - FREQ=NONE;ACTION=EMAIL;TRIGGER=DATE-TIME:${FechaVto}
                                                                                                  • Trying to setup a record to automatically create on a weekly basis

                                                                                                    Hello all, I need multiple records to be automatically created on a weekly basis. What I'm trying to accomplish is, I have a maintenance database where I track when I work on IT related systems. Every week on the same days I perform backups on systems
                                                                                                  • Set Mandatory Lookup Fields in Ticket Layout

                                                                                                    I added a custom module called 'Site' in the desk. I also added a lookup field 'Site' in the ticket layout. Now, I want the 'Site' field to be mandatory in the blueprint transition. How can I do that?
                                                                                                  • Custom Roles & Granular Permission Control in Zoho SalesIQ

                                                                                                    Hello Zoho SalesIQ Team, We appreciate the functionalities offered by Zoho SalesIQ, but we would like to request a crucial enhancement regarding user roles and permissions. Current Issue: At present, Zoho SalesIQ provides fixed roles—Admin, Supervisor,
                                                                                                  • Help with cookie code, utm variables are overwritten on every page load with new variables

                                                                                                    Hi all, My goal is to track the very first web page that a user visits, and store those utm values throughout all of the future visits until a lead form is submitted. That way, if a person is retargeted, I can still attribute the very first visit as the
                                                                                                  • Alignment of Company Information Page Structure in Zoho One and Zoho Desk

                                                                                                    Hello Zoho One Support, We appreciate the continuous improvements across Zoho products. Recently, Zoho Desk restructured the Company Information page into three distinct sections: Company Profile – Includes Company Name, Logo, Alias, Description, Website,
                                                                                                  • How to connect the Squarespace website with Zoho Thrive

                                                                                                    Our website is created using Squarespace. To boost our sales, I planned to do the affiliate program and I thought to integrate our website store with Thrive. but I don't see the Squarespace platform. if I choose the custom build, I have to generate the
                                                                                                  • Gravity Forms plugin not passing some fields

                                                                                                    I use the gravity form zoho plugin to push data from my lead form into my lead page in Zoho CRM. Everything was working file for about 6 months. Suddenly on Oct 1st, some of the fields are no longer getting passed to Zoho. The fields with the problem
                                                                                                  • Introducing 'Queries' In Zoho CRM

                                                                                                    Hello everyone! We are here with an exciting feature - Queries in Zoho CRM! A little context before we dive right into the feature specifics :) In today’s fast-paced business environment, immediate access to relevant data is essential for informed decision-making.
                                                                                                  • Weekly Tips: SecurePass For Extra Security

                                                                                                    Imagine sensitive data from your organisation sent via email is being accessed by unintended recipients. The sensitive data can range from Personal Identification Information to a tender quotation or a client’s NDA document. The unintended access could
                                                                                                  • Auto Copying an field from auto generated field in zoho crm

                                                                                                    I have products module in zoho crm, in which i have Part Number which is auto generated whenever the new product is created, i have made another field by name "SKU Number" i want that value of "Part number" should be auto copied to "SKU Number" whenever
                                                                                                  • Calling a function within another function

                                                                                                    Hello there, I have just found out that you can simply call up functions in other functions, regardless of the department. You can't create functions with the same name twice, even though you are in a different department. If you try it, you don't get
                                                                                                  • Related Record Bug

                                                                                                    Hi, Report a bug. Related record amount currency will display default currency (AUD) not the actual one (CNY). While if we click into the record and back, the currency will change to CNY (Correct). Then If we refresh browser, currency still show AUD
                                                                                                  • Introducing Social Toolkit

                                                                                                    Hi everyone, We're thrilled to launch Social Toolkit, a one-stop dashboard to help take your social media presence to new levels by letting you create aesthetic profiles and share content that your audience will actually enjoy engaging with. Social Toolkit
                                                                                                  • Zoho Forms - Shared Forms

                                                                                                    I chose SHARED FORMS and noticed "Enter atleast" needs a space to be correct.
                                                                                                  • Email Verification on Subdomain

                                                                                                    Hi, The latest guidelines for setting up an email newsletter are to set it up on a subdomain of your main domain so that if you get put in a spam block, it doesn't block all your company email. We have been trying to set this up and managed to get our
                                                                                                  • Posibility to add Emoticons on the Email Subject of Templates

                                                                                                    Hi I´ve tried to add Emoticons on the Subject line of Email templates, the emoticon image does show up before saving the template or if I add the Emoticon while sending an Individual email and placing it manually on the subject line. Emoticons also show
                                                                                                  • How to display Motivator components in Zoho CRM home page ?

                                                                                                    Hello, I created KPI's, games and so but I want to be able to see my KPI's and my tasks at the same time. Is this possible to display Motivator components in Zoho CRM home page ? Has someone any idea ? Thanks for your help.
                                                                                                  • Custom module - change from autonumber to name

                                                                                                    I fear I know the answer to this already, but thought I'd ask the question. I created a custom module and instead of having a name as being the primary field, I changed it to an auto-number. I didn't realise that all searches would only show this reference.
                                                                                                  • Show my cost or profit while creating estimate

                                                                                                    Hi, While creating estimate it becomes very important to know exact profit or purchased price of the products at one side just for our reference so we can decide whether we can offer better disc or not .
                                                                                                  • Show Zoho Cliq Reminders in Zoho Calendar

                                                                                                    Hi Zoho Team, I hope you're doing well. We appreciate the existing integration between Zoho Cliq and Zoho Calendar, which allows meetings scheduled via Cliq to be displayed in the calendar. However, we’ve noticed that reminders set in Zoho Cliq do not
                                                                                                  • Pushing GCLID info from Gravity Forms to ZohoCRM

                                                                                                    We are switching to Gravity Forms from Zoho Forms and I cannot find any good info on how to make sure my GCLID tracking info is pushed through to the CRM through my new forms. There was an article in the documentation about placing something within the
                                                                                                  • 【Zoho CRM】アクセシビリティ向上機能リリースのお知らせ

                                                                                                    ユーザーの皆さま、こんにちは。コミュニティチームの中野です。 今回は「Zoho CRM アップデート情報」の中からアクセシビリティ向上機能をリリースしましたのでご紹介します。 アクセシビリティ向上機能とは? すべての人が快適に利用できるように、フォントサイズの調整、色覚サポート、キーボード操作の最適化など、18のアクセシビリティコントロールを提供し、ユーザーのニーズに応じたカスタマイズを可能にします。 概要動画はこちら(英語) 以下にて、本機能の一部を紹介します。 アクセシビリティ向上機能の設定方法
                                                                                                  • 5名限定 課題解決型ワークショップイベント Zoho ワークアウト開催のお知らせ(2/27)

                                                                                                    ユーザーの皆さま、こんにちは。Zoho ユーザーコミュニティチームの藤澤です。 2月開催のZoho ワークアウトについてお知らせします。 今回は久しぶりに品川にて「オフライン開催」します!! ※定員に達したため、受付を終了しました。 ━━━━━━━━━━━━━━━━━━━━━━━━ Zoho ワークアウトとは? Zoho ユーザー同士で交流しながら、サービスに関する疑問や不明点の解消を目的とした「Zoho ワークアウト」を開催します。 Zoho サービスで完了させたい設定やカスタマイズ、環境の整備など……各自で決めた目標達成に向け、
                                                                                                  • I want to change the threshold for data quality.

                                                                                                    The following error occurs in Zoho Data Prep. > The export was interrupted because the quality of the data set (88.147) is below the minimum quality (100) set. I want to change the data quality threshold, but where can I do this? Translated with DeepL.
                                                                                                  • Bulk change color of selected notes

                                                                                                    When I select several notes, I want to change their color, but there is no such function. I miss it.
                                                                                                  • 📣📣 Zoho Bookings - Feature Roadmap 2024

                                                                                                    Hi Everyone, Thank you for all the support you have been showing Zoho Bookings. We had a fabulous 2023, with a bunch of new features and over 60K new users. In 2024, our prime focus will be on user experience, and we have a few vital features coming in
                                                                                                  • Client Script | Update - Introducing Subform Events and Actions

                                                                                                    Are you making the most of your subforms in Zoho CRM? Do you wish you could automate subform interactions and enhance user experience effortlessly? What if you had Client APIs and events specifically designed for subforms? We are thrilled to introduce
                                                                                                  • Importing Attendees- Excel

                                                                                                    I would like the ability to import attendees using an excel file. Sometimes groups, such as schools have to sign up attendees through there system and then send my organization an excel spreadsheet. Right now there doesn't seem to be a way to import those attendees. If Backstage can export to an excel file it seems like a no-brainer that one would be able to populate that template and import attendees into Backstage.
                                                                                                  • Python Code: Calling "Deals" API results in 404 Error.

                                                                                                    Good evening, I wrote a small python code to scrape the data from a selected record and then copy the information I need into another website. We have renamed the "Deals" module to "Opportunities", however the API name remains as "Deals" which is fine.
                                                                                                  • Bad change: Zoho Notebook Android app requiring Google Play Store login

                                                                                                    I have been a Zoho user for a decade or so, and a One subscriber for several years. There are always areas for improvement, but on the whole, I've been quite happy with it. A big part of my choice to go wtih Zoho is that I value data privacy, and try
                                                                                                  • Marking a Desk ticket as Unread after merge

                                                                                                    We have a custom script that runs against every new ticket and auto-merges it with any existing ticket that matches our criteria. That works fine but there is no functionality that reverts the newly-updated ticket back to an "unread" state. I found the
                                                                                                  • Need best practices and ideas for group calendars or personal calendar with group invite

                                                                                                    Please share your ideas and best practices to use Calendars. Here's the situation. Using a group calendar to hold weekly recurring meetings for the "Design Team" means that Design Team members can easily view/hide the calendar. However, it also means
                                                                                                  • Restrict Payment Methods

                                                                                                    Allow us to restrict certain payment methods specific for each customer.
                                                                                                  • Issue with Bin Locations and Stock Counting in Zoho Inventory

                                                                                                    Dear Zoho Support, We are currently experiencing a significant issue with bin locations and stock counting in our warehouse. Our warehouse is divided into 7 zones, each containing approximately 250 bin locations. When performing a stock count for an item,
                                                                                                  • How to block a WhatsApp user for sending spam

                                                                                                    Is there a way to block those whatsapp users that just come to play and annoy our service, they also spam us. We have a waba service with sales iq
                                                                                                  • Next Page