Workflow Custom Function for any existing Module for Box

Workflow Custom Function for any existing Module for Box

The Box extension for Zoho CRM is one convenient way to access stored data and share files with leads and contacts (by default) from Zoho CRM. You can extend this functionality to custom modules too. Follow the steps below to see how it's done.

To associate the above custom function to a workflow rule:

  1. Click Settings > Setup > Automation > Workflow Rules.
  2. In the Workflow Rules page, click the Create Rule button.
  3. In the Create New Rule tab, specify workflow rule parameters that you require.
  4. Execute the workflow during Record Actions. Select Create or Edit and click Next.
  5. Select All Records in the following options. Next, select Custom Function to be triggered under an Instant Action.
  6. Associate the custom call function to be triggered. Click Save.

To create custom buttons:

  1. Click the Settings > Setup > Customization > Modules.
  2. Click $Module of your choice$ > Layout.
  3. Drag and drop the Fields from the New Fields tab.
  4. Click Save.
//Note: the custom function should have "record_id" parameter

// getting record info from Leads or Quotes using the record_id
   
    quote_info = zoho.crm.getRecordById("Quotes", quote_id.toLong());

// Getting Box folder ID from the record info

    box_folder_id = quote_info.get("Box Folder ID");

   if ((box_folder_id  ==  null)  ||  (box_folder_id  ==  ""))

   {

      rootFolderId = zoho.crm.getOrgVariable("box.box_rootfolder_id");

        if (rootFolderId  ==  "")

        {

// Returning since the root folder ID is empty

            return;

        }

       tokenObj = map(); 	
       tokenObj.put("folder_name", "Quotes");

       tokenObj.put("parent", rootFolderId);

// Using the token object and Box connector to call the invoke connector 
      from CRM API
      createFlrResp = zoho.crm.invokeConnector
                     ("box.box.createboxfolder", tokenObj, true);
        if (createFlrResp  ==  null){

                 return;

            }
// Get the status code from the createFlrResp

        status_code = createFlrResp.get("status_code");

        quote_folder_id = "";

        resp_obj = createFlrResp.get("response");

// Checking for same folder name

        if (status_code  ==  "409")

       {

            context_info = resp_obj.getJSON("context_info");

            conflict_ids = context_info.getJSON("conflicts").toJSONList();

            for each entry in conflict_ids

            {

                quote_folder_id = entry.getJSON("id");

            }

       }

// Returns the folder ID if these conditions satisfy

        else if ((status_code  ==  "201")  ||  (status_code  ==  "200"))

        {

            quote_folder_id = resp_obj.getJSON("id");

        }

           if (quote_folder_id  ==  "")

        {

            return;

        }

//Get the record name if folder ID exists

        first_name = quote_info.get("Subject");

tokenObj1 = map();

tokenObj1.put("folder_name", first_name);

tokenObj1.put("parent", quote_folder_id);

 

// Update the folder id and record name using API

 

createFlrResp1 = zoho.crm.invokeConnector
                  ("box.box.createboxfolder", tokenObj1, true);

status_code1 = createFlrResp1.get("status_code");

resp_obj1 = createFlrResp1.get("response");

rec_folder_id = "";

  if (status_code1  ==  "409")

  {

            context_info1 = resp_obj1.getJSON("context_info");

            conflict_ids1 = context_info1.getJSON("conflicts").toJSONList();

            for each entry1 in conflict_ids1

            {

                rec_folder_id = entry1.getJSON("id");

            }

          }

        else if ((status_code1  ==  "201")  ||  (status_code1  ==  "200"))

        {

            rec_folder_id = resp_obj1.getJSON("id");

        }

        if (rec_folder_id  !=  "")

            {

            updateMap = map();

            updateMap.put("Box Folder ID", rec_folder_id);

// Update the Box folder ID using the CRM API

            update_resp = zoho.crm.updateRecord
                          ("Quotes", quote_id + "", updateMap);

             }

        return;

    }		
Related List For Quotes Module :

// Note: the custom function should have "record_id" parameter

// Getting record info from Leads or Quotes using the record_id

    quote_info = zoho.crm.getRecordById("Quotes", quote_id.toLong());

    box_folder_id = quote_info.get("Box Folder ID");

 

// satisfies the below conditions if folder id is empty
if ((box_folder_id  ==  null)  ||  (box_folder_id  ==  ""))

    {

        rootFolderId = zoho.crm.getOrgVariable("box.box_rootfolder_id");

        if ((rootFolderId  ==  "")  ||  (rootFolderId  ==  "none"))

        {

            xmlList = ("Folder for Zoho CRM is not created yet in Box. 
If you are an administrator, please go to Box Settings tab and create
a Root Folder.
And, if you are not an administrator please contact your administrator."); return xmlList; } // Creates the folder name as module name under
      the root folder if folder id exists

        tokenObj = map();

        tokenObj.put("folder_name", "Quotes");

        tokenObj.put("parent", rootFolderId);

        createFlrResp = zoho.crm.invokeConnector
                        ("box.box.createboxfolder", tokenObj, true);

        if (createFlrResp  ==  null)

        {

            xmlList = "Please authorize Box to view Box Files. 
                       You can authorize Box in Box Settings tab.";

            return xmlList;

        }

        status_code = createFlrResp.get("status_code");

        quote_folder_id = "";

        resp_obj = createFlrResp.get("response");

//Satisfies the below condition when the folder name comes same

        if (status_code  ==  "409")

        {

            context_info = resp_obj.getJSON("context_info");

            conflict_ids = context_info.getJSON("conflicts").toJSONList();

            for each entry in conflict_ids

            {

                quote_folder_id = entry.getJSON("id");

            }

        }

        else if ((status_code  ==  "201")  ||  (status_code  ==  "200"))

        {

            quote_folder_id = resp_obj.getJSON("id");

        }

        if (quote_folder_id  ==  "")
         {

            xmlList = ("No files exists for this record.");

            return xmlList;

        }

//get the record name and folder id from quote_info

        first_name = quote_info.get("Subject");

        tokenObj1 = map();

        tokenObj1.put("folder_name", first_name);

        tokenObj1.put("parent", quote_folder_id);

        createFlrResp1 = zoho.crm.invokeConnector
                        ("box.box.createboxfolder", tokenObj1, true);

        status_code1 = createFlrResp1.get("status_code");

        resp_obj1 = createFlrResp1.get("response");

        rec_folder_id = "";

        if (status_code1  ==  "409")

        {

            context_info1 = resp_obj1.getJSON("context_info");

            conflict_ids1 = context_info1.getJSON("conflicts").toJSONList();

            for each entry1 in conflict_ids1

            {

                rec_folder_id = entry1.getJSON("id");

            }

        }

        else if ((status_code1  ==  "201")  ||  (status_code1  ==  "200"))

        {

            rec_folder_id = resp_obj1.getJSON("id");

        }

//Update the folder id using the crm API

        if (rec_folder_id  !=  "")

        {

            updateMap = map();

            updateMap.put("Box Folder ID", rec_folder_id);

            update_resp = zoho.crm.updateRecord
                        ("Quotes", quote_id + "", updateMap);

        }

        xmlList = ("No files exists for this record.");

        return xmlList;

    }


    else

    {
  	 tokenMap = map();

        tokenMap.put("FOLDER_ID", box_folder_id);

        tokenMap.put("limit", 100);

        tokenMap.put("offset", 0);

//get the folder items created under the root folder using the token object

        folder_items_map = zoho.crm.invokeConnector
                        (("box.box.getfolderitems"), tokenMap, true);

        folder_items_status = folder_items_map.get("status_code");

        if (folder_items_status  ==  "200")

        {

            listfolder_resp = folder_items_map.get("response");

            entries = listfolder_resp.getJSON("entries");

            entries_list = entries.toJSONList();

            if (
               (entries_list.toString() == null) || (entries_list.size() == 0)
               )
            {

                xmlList = ("No files exists for this record.");

                return xmlList;

            }

//Get the json object items from the entries list

            else

            {

                i = 0;

                recordsXmlStr = "";

                for each entry in entries_list

                {

                    type = entry.getJSON("type");

                    name = entry.getJSON("name");

                    id = entry.getJSON("id");

                    description = "";

                    if (toString(entry).indexOf("description")  >  0)

                    {

                        description = entry.getJSON("description");

                    }

                    if ((description  ==  null)  ||  (description  ==  ""))

                    {

                        description = "--";

                    }

                    size = "";

                    if (toString(entry).indexOf(("size"))  >  0)

                    {

                        size = entry.getJSON(("size"));

                    }

                    if (
                   ((size  ==  null) || (size  ==  "null")) || (size  ==  ""))

                    {

                        size = "0";

                    }

                    content_modified_at = "";

                    if (toString(entry).indexOf("content_modified_at")  >  0)

                    {

                        content_modified_at = entry.getJSON
                                             ("content_modified_at");

                    }

                    if (content_modified_at  ==  null)

                    {

                        content_modified_at = "";

                    }

                    modified_by = "";

                    if (toString(entry).indexOf("modified_by")  >  0)

                    {

                        modified_by = 
                              entry.getJSON("modified_by").getJSON("name");

                    }

                    if (
                        ((modified_by == null) || (modified_by  ==  "")) || 
                              (modified_by == "null")
                       )

                    {

                        modified_by = "--";

                    }

                    shared_link = "";

                    if (toString(entry).indexOf("shared_link")  >  0)

                    {

                        shared_link = entry.getJSON("shared_link");

                    }

                    shared_link_url = "--";

                    if (
                        ((shared_link == null) || (shared_link == "null")) 
                        || (shared_link  ==  "")
                       )

                    {

                        shared_link_url = "--";

                    }

                    else

                    {

                        shared_link_url = shared_link.getJSON("url");

                    }
                     link = "https://app.box.com/files/0/f/" 
                              + box_folder_id + "/1/f_" + id;
                    if (type  ==  "folder")

                    {

                        link = "https://app.box.com/files/0/f/" + id + "/";

                        type = "Folder";

                    }

                    else

                    {

                        type = "File";

                    }

                    if (content_modified_at  !=  "")

                    {

                        content_modified_at = content_modified_at.replaceAll
                                                    ("T"," ");

                    }

                    size_str = "-";

                    size_str = ((((size).toDecimal()  /  1024))) + "";

                    if (size_str.indexOf(".")  >  0)

                    {

                        pos = (size_str.indexOf(".")  +  3);

                        if (pos  >  size_str.length())

                        {

                            pos = size_str.length();

                        }

                        size_str = size_str.subString(0,pos);

                    }

                    size_str = (size_str) + " KB";

//Construct the xml using the above responses

               recordsXmlStr = recordsXmlStr + "";

               recordsXmlStr = recordsXmlStr + "";

               recordsXmlStr = recordsXmlStr + "" + type + "";

               recordsXmlStr = recordsXmlStr + "" + description + "";

               recordsXmlStr = (recordsXmlStr + "" + size_str) + "";

               recordsXmlStr = recordsXmlStr + "" + content_modified_at + "";

               recordsXmlStr = recordsXmlStr + "";

                    if (shared_link_url  ==  "--")

                    {

                        recordsXmlStr = recordsXmlStr + "--";

                    }

                    else

                    {

                        recordsXmlStr = recordsXmlStr + "Shared Link";

                    }

                    recordsXmlStr = recordsXmlStr + "";

                }

                recordsXmlStr = recordsXmlStr + "";

                return recordsXmlStr;

            }

        }

        else if (
            (folder_items_status == "401") || (folder_items_status == "404")
                )

        {

            xmlList = ("You need to be invited to the Box root folder.
Please contact your administrator to get access to content
            already linked to this record.");

            return xmlList;

        }

        else

        {

            xmlList = ("Unable to get files related to this record from Box.");

            return xmlList;

        }

    }
    • Sticky Posts

    • Introducing Kanban Board Extension for Zoho CRM

      Zoho CRM has been helping you with your business in many ways. The foundation of it all is that it is keeping all your data well organized and maintained. It makes work easier for you but what if that was not all.  Yes! That is not all; we now provide the Kanban Board extension that provides a visual management for your CRM data. It is a great way to view all the records segregated the way you want to see them. Be it based on deal status, lead pipeline stage, or campaign type or any other pick list
    • Here's what you can do with your DocuSign Extension

      Contracts, agreements, and other documents have always been an integral, concluding part of any sales process. With the free DocuSign Extension for Zoho CRM, we've made certain that your signing process is entirely digital, and there is no need for copies,
    • Contact Info Extractor Chrome plugin

      Just trying out the Contact Info Extractor plugin and had a quick observation.  Since a target website for this plugin would be LinkedIn, I'm very surprised that the plugin cannot determine that if the selected text in question includes... Joe Smith Vice President at ABC Corporation ... the plugin can recognize the name and title but not the company.  I'd assume that the term "at" would give it the needed clue but on several contacts I tried to add, it's just not catching it. Would love to see the
    • Easily send documents from Egnyte to your leads in Zoho CRM

      Understanding your customers and educating them about your product are two sides of the same sales coin. During a sales process, to educate your potentials about your product, you may have to send them user guides, help documents, comparison sheets, and
    • Empower Your Sales Team with Email Marketing Insights Using the Mailchimp Extension

      Email marketing is one of the most powerful tools available for engaging leads. It’s low cost and high ROI makes it a top choice for marketers who want to establish contact with leads. But these leads can only be turned into actionable deals when pursued
    • Recent Topics

    • "Extra keys limit has exceeded"

      Hello, Has anyone encountered the below message before in a workflow log failure: "Update Record Response is {\"code\":52,\"message\":\"Extra keys limit has exceeded\"}" The script is supposed to generate an invoice for a deposit when a deposit payment
    • Collapsible Sections & Section Navigation Needed

      The flexibility of Zoho CRM has expanded greatly in the last few years, to the point that a leads module is now permissible to contain up to 350 fields. We don't use that many, but we are using 168 fields which are broken apart into 18 different sections.
    • use of comma as a decimal separator

      Hello, I wish to find a way to customize the number format for my proper use. I have to use french data, where the "," is used as the decimal separator : for example the french way to write "3.99�" is "3,99�" Is it possible to do it in Zoho Sheet ? If this is not actually the case, I'd love this feature to be implemented !
    • Ability for customer to give feedback after receipt of an order

      Is there any way we can receive feedback from customers regarding their order after delivery (other than just an email, obviuosly)? This is not the same as product reviews, as it may concern other points, but would ideally have an inbuilt reference to
    • Zoho meeting api not working in trial version

      I have and free trial meeting access. When i have tried to create a authentication code for meeting it shows Invalid OAuth Scope error. My code: $client_id = 'client_id'; $redirect_uri = 'site_url'; $scope = 'ZohoMeeting.organize.CREATE,ZohoMeeting.organize.READ';
    • Why is Nordic No Longer Available as a Translation Service for Email

      I routine receive email in Nordic but now it has been removed from the list of available translations. Why?
    • Create WorkDrive Folder with specific Sub-Folders when new Zoho CRM entry in "Accounts" Module

      So, my flow creates a WorkDrive Folder in the required Team Folder, but I want the same flow to create four Subfolders within the new folder. Man, Woman, Boy & Girl sub-folders I was looking at this below but how do I identify the new Parent folder as
    • Live webinar: 2024 recap of Zoho Show

      Hello all, 2024 has been an incredible year for Zoho Show! We've listened to your feedback and worked continuously to strengthen the tools you use to create, collaborate, and deliver presentations. From rolling out new features to enhancing existing ones,
    • Changing Customer Currency

      It seems so silly that you can't change a customer's currency after a transaction is recorded. We work with companies all over the world and sometimes they might request an invoice in a different currency. To do this I have to create another customer
    • Bulk payment of bills from multiple vendors

      Is there a way to pay multiple vendors bills in one transaction?  It appears that you have to deal with each one as a seperate transaction.  Is there a way to export the transactions to the bank using an ABA file?
    • WorkDrive API Documentation

      WorkDrive provides users and developers an extensive set of APIs to help integrate functionalities of Zoho WorkDrive with other Zoho applications and third-party tools. We have published the official WorkDrive API Documentation page for all external users.
    • Record Asset Received as Payment

      How exactly would you account for this in books? For example, I receive a mini computer for a review and I get to keep it after the video is published. Would debit my normal asset account (e.g. Computers) and credit an income account (e.g. Other Income).
    • Line_Items not appearing in invoice arrays

      When i use the Zoho API to pull an invoice, it doesnt show the Line_items array... In the documentation it shows that it should appear but it does not. Is there any way to fix this?
    • Active Customer List 2024

      Hello everybody, i am just a beginner :) how can i create a customer list of all active customer in 2024? Active customer means, all customers, who received an invoice in 2024 of us. Just tried already in CRM. Can i do that also in ZOHO books? I am looking
    • Notifications on mentions in comments

      If another user mentions me (e.g. @mustafa... which autocompletes) in a comment on a ticket, how do I get notified? If I don't get notified, what on earth is the point of the mention feature???
    • [New] Create invoices and contracts in minutes with Zoho Writer's Merge Templates for Bigin!

      Do you often find yourself manually entering customer information in your business documents like invoices and contracts? This can be a time-consuming process that can take up valuable time from your business operations. With Zoho Writer's Merge Templates
    • Setup for a service based business

      I apologise if this has been asked before but a search of the forums didn't turn up what I was looking for. I am looking at setting up Zoho CRM for a consultancy based business and so there are no products as such. This is fine as I can create a product which is time based. However, I do not seem to be able to get rid of the concept of having quantity in stock. I have a unlimited supply of time! How can I bend Zoho to my will and get rid of the stock control? Thanks Neil
    • Introducing the New SalesIQ Live Chat Widget: Twice as Fast, Fully Optimized for Engagement!

      Hello everyone! To celebrate our 10-year milestone, we're thrilled to unveil the new and improved SalesIQ Live Chat Widget! Redesigned at both the User Interface and performance levels, this enhanced widget is not only optimized but also 2X faster than
    • Search terms from ASAP widget are not showing up in my Zoho Desk analytics

      When people perform searches in the Zoho Desk ASAP widget, the search terms do not show up inside my analytics report. But when people access the KB website directly and then do the search, the keywords ARE showing up. Is this a known issue, or am I just
    • Microsoft Loop integration

      Hi has anyone had luck getting any components of Microsoft Loop integrated into Zoho One, for example Follow-up tasks into Zoho Projects or other app, or perhaps Loop notes into Zoho Notes? cheers
    • Searching for content within courses

      Hello, I have been testing out Zoho One for my company have been exploring Learn. I've noticed that you cannot search for content within a course. You can only locate the title of the course. Example: Course: How to Make Your Bed Chapter: Pillows Lesson:
    • Cohort - Zoho Analytics

      I am developing a cohort analysis in Zoho Analytics for Tickets/Service Desk, which tracks the number of tickets created each month and when those tickets were closed. I have added a user filter for classification. When I change the classification using
    • Function #6: Calculate Commissions for paid invoices

      Zoho Books helps you automate the process of calculating and recording commissions paid to sales persons using custom functions. We've written a script that computes the commission amount based on the percentage of commission you enter and creates an
    • Helper Functions and DRY principle

      Hello everyone, I believe Deluge should be able to use 'Helper functions' inside the main function. I know I can create different standalones, but this is not helpful and confusing. I don't want 10000 different standalones, and I dont want to have to
    • Automation Issue with Email Templates in Workflow

      Hello Zoho Support Team, I’m currently facing an issue with the automation setup in my workflow for following up with applicants. I have configured the workflow to send out emails with different templates, which work perfectly when sent manually. However,
    • Disable Private Reply.

      Is it possible to disable the option to do "Private Reply" for tickets? The reason is that sometimes we click on reply or "reply all," but the system automatically selects "private." Am I doing something wrong? Thanks Rudy
    • Zoho Books | Product Updates | October 2024

      Hello users, We're back with fresh feature updates in Zoho Books. Starting from associating an applicable period for TDS taxes to minimised tab view for web tabs, discover the latest enhancements that will streamline your workflow and elevate your accounting
    • Merge Items

      Is there a work around for merging items? We currently have three names for one item, all have had a transaction associated so there is no deleting (just deactivating, which doesn't really help. It still appears so people are continuing to use it). I also can't assign inventory tracking to items used in past transactions, which I don't understand, this is an important feature moving forward.. It would be nice to merge into one item and be able to track inventory. Let me know if this is possible.
    • Failures installing Unattended Agent using Microsoft Intune

      Hello, I configured Zoho Assist Unattended Agent using Microsoft Intune, following the steps outlined in this article, using a .MSI installer. I added a pilot group of users and for 6 of them it installed correctly and I see their computers in Zoho Assist
    • Getting list of calendar events over api for zoho mail calendar

      Hi, I am using just Zoho mail without using Zoho CRM. I wanted to get all events booked in my zoho mail calendar through an api at regular intervals. I could find such API support for Zoho CRM calendar but not for zoho mail calendar. Can you kindly let
    • 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}
    • Recurring Bookings

      Will Zoho Bookings ever offer an option to the customer to schedule recurring meetings (unlimited) for the same days/times? Making a client schedule the same days/times for an entire month is a tedious process. I'd like to offer the option upfront to
    • Zoho CRM's new Homepage component: See all your activities in one powerful view!

      Hello everyone, We’re excited to introduce a new feature to your CRM dashboards: the Homepage Open Activity Component! Now you can effortlessly track all your open activities—including tasks, meetings, calls, and appointments—in a unified view, tailored
    • No fue posible enviar el mensaje;Motivo:553 Relaying disallowed. Invalid Domain - admin@laboratoriosantarosa.org

      Hola Renovamos después del tiempo el dominio, y luego de eso se cayó el servicio de correo. Seguimos las indicaciones que se indican en este articulo, sin embargo, hasta el momento solo podemos recibir correos pero no enviar. Hemos actualizado los registros
    • Add an option to start zobot when user clicks the Chat with Us button

      I would like to have an option to start the zobot when user clicks on "Chat with us" button when chat widget is maximized
    • Ticket list sorting is now supported in the latest version of the Desk Android mobile app.

      Hello, In the latest version of the Desk Android mobile app (v2.4.32), we have brought in the option to sort the ticket listing view.   Now we can sort the tickets listing by Ticket Id, Due Date, Recent Thread and Created Time. Please update the app either
    • Mass delete leads

      How do I mass delete leads in ZMA? I want to delete leads that have not opened emails in 6 months. But I can only select 200 at a time - there are thousands.
    • Creator v5, v6 and v8 for Zoho One

      Greetings, I hope find all doing well and safe. I was browsing the Zoho One page, where the details of each application's plans are outlined (https://www.zoho.com/one/plan-details.html?prd=zcreator). I noticed there are three versions available for Creator
    • Base Currency Adjustment - Mark Transaction as Something Other than Unreconciled

      Not a very concise title, but it describes the issue pretty well. Basically, when a Base Currency Adjustment is made, the transaction is recorded in the register of the account in question (as it should be). It's marked as "Manually Added", which makes
    • Customer Account Statement

      Dear Sir, I am Travel Agent Curranty Zoho Provide Customer Statement with Date, Transactions, Details, Amount, Payments, Balance Our Suggestion is kindly Provide Statement with Item name & Description Kindly find the attachment
    • Next Page