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

    • ¡Zoholics vuelve en 2025! ¡Apúntate esta fecha!

      ¡Que levante la mano quien echó de menos Zoholics este año! ¡Nosotros también! Si nunca has estado en Zoholics, te lo explicamos aquí para que no te pierdas esta oportunidad. Te alegrará saber que los planes para el gran regreso de Zoholics en 2025 ya
    • ¿Qué es Zoholics y por qué no te lo puedes perder?

      ¡Reúnete con el universo Zoho en nuestro mayor evento y construye el modelo que lleve a tu empresa al éxito! Zoholics es el encuentro de usuarios de Zoho donde nos reunimos con nuestros usuarios cara a cara para ayudaros a comprender mejor nuestros productos.
    • Validation rules for fields used in blueprints

      Dear community, I'm designing a blueprint for me leads nurturing process and I've noticed an issue with the validation rules applied for fields. I've applied a validation rule for the "PHONE" field and it's working just fine when I insert a new phone
    • Canvas View - Print

      What is the best way to accomplish a print to PDF of the canvas view?
    • Zoho Sign "Create" Template button no visible. Admin

      I just recently got promoted to Admin access for Zoho One, and in our Zoho Sign account; the create template button is no longer available to my view? I've tried multiple browsers and even Windows and Mac. Any thoughts?
    • Change/reallocate different key combinations to enable the Zia Search feature in Zoho Projects

      Hello, Typically the cmd + "/" or Ctrl + "/" keys combination is used for commenting a code line. However, in the custom function module in Zoho Projects (specifically), the key combinations triggers Zia Search widget which distracts during coding and
    • Live webinar: 2024 recap of Zoho WorkDrive

      Hello everyone, We’re excited to invite you to our year-end live webinar! This session will take you through the transformative features and updates we’ve introduced in Zoho WorkDrive this year, helping you streamline document management like never before.
    • Streamline appointment booking for patients | Kiosk Studio Session #3

      Hello everyone! You may be using kiosks today to help your CRM users streamline their workflows and enhance efficiency. These users could be sales reps in a manufacturing company, agents in a real estate firm, clerks in a government agency, and so on.
    • Function #46: Auto generate list of lapsed customers using Custom Button

      Hello everyone, and welcome back to our series! Customer retention is one of the key factors that impact the long-term success and sustainability of a business. High customer retention rates indicate satisfied customers, quality products or services,
    • Help Needed to Recover Emails After Deactivating Zoho Account

      Hello Zoho Community, We deactivated our Zoho account two days ago but unfortunately did not properly transfer our email services before doing so. As a result, we’ve lost access to our Zoho emails and data. Is there any way to reactivate our Zoho account
    • Automatically update date field based on the pick-list value of another field

      Hello everyone, I've been trying to find a way where a date field gets automatically updated according to the value of a different pick-list field. The pick-list field can have the value "3 months from now" or "6 months from now". The logic is that we
    • How to use an output from a function as a criteria on a decision path on Kiosk

      Dear community, Is it possible to use the result of a function executed in a Kiosk flow as a criteria in a decision step in Kiosk studio? Let's supose I have a function that makes an API request. Is it possible to define the next step of the Kiosk flow
    • Creator - Programmatic Update not Triggering Flow

      I have a Flow set up to be triggered by a Record Updated action in Zoho Creator. When I update the record manually via the UI, everything works as expected. However, I have a workflow that can be triggered in the UI to update a specific field in the Creator
    • Kaizen #89 - Color Coding using Client Script

      Hello everyone! Welcome back to another exciting Kaizen post. Today let us see how you can apply color codes to the List and Detail Pages of Zoho CRM using Client Script. Need for color code in Zoho CRM When you mark things with different colors as a
    • Unattended Access session confirmation exclusion list suddenly not working

      As of Friday, the session confirmation exclusion list is not being respected. Instead all remote sessions are prompting for confirmation, including those in the exclusion list. For some of our critical shared machines this is a significant issue as the
    • Connecting Zoho Creator app with Zoho Sites

      I created a custom domain on Zoho Creator for my app (and it is verified), but when I click the link for my custom domain, it redirects me to my website. I want to link my portal to my website so that customers don't have to sign in to multiple locations.
    • Add a way of clearing fields values in Flow actions

      It would be great if there was an option to set a field as Null when creating flows. I had an instance today where I just wanted to clear a long integer field in the CRM based on an action in Projects but I had to write a custom function. It would be
    • Feature Request: Export\Import Flows

      Hi, As A Zoho Systems Builder and implementer, I Like Working With this great tool! Makes my automation work a lot Easier! Thanks! It would Save me a lot of time if I would be able to export And import flows (To JSON).
    • Teaminbox whatsapp integration not working since saturday

      Hi, I dropped an email to support@zohoone.com and a web form. But I didn't get any responses. I checked the whatsapp link via the setup > Organization > Organization > Channels, and checked the whatsapp accounts in facebook business portfolio, it's all
    • How do I list all users and their email addresses within an application?

      The application I created is a system where by users submit issues.  An admin will then assign the issue to a particular user (not necessarily the one who submitted it).   Obviously I need to create the users in the Setting page and allow them access to the parts of the app that are relevant to them.    My question is this:   Is it possible to create on a form a dropdown box that will show the available users or do I need to create the user a second time within a table (ie.  Name, Email, etc...)?
    • Springlearns: How Can Zoho CRM Help Streamline Our Training Program Management and Client Engagement?

      Hi Zoho CRM Community, We are a provider of professional training solutions, and are looking to improve our client relationship management and streamline our training program operations. As we expand our offerings in project management, IT certifications,
    • Switch to enable or disable sent notification when close a ticket

      Some time you need to turn off the notification email on closing a ticket. But the only way is in the Settings of Zoho Desk. It would be great to have a switch in the ticket just to disbale for once the notification mail when close the ticket.
    • Sync Zoho Desk Teams with Zoho One Departments and/or Groups

      Dear Zoho Team, Greetings! We would like to request an enhancement to improve the integration between Zoho Desk and Zoho One. Currently, when creating or updating an employee in Zoho One, we can add them to the Zoho Desk application and configure their
    • Report to show tickets win non invoiced time entries.

      I have a report that lists tickets and associtated time entries for a specified period of time. Is there a filter that can be applied to show only tickets that have time entries that have not been marked as invoiced? Or what is the best way for our billing
    • Zoho Desk and Zoho Inventory

      I am hoping I am not the only one with this need but has anyone else notice the lack of integration between Zoho Desk and Zoho Inventory and eventual funneling into an Invoice in Zoho Books?  As an IT service provider we very often will sell parts (items) along with services for installing said item(s).  I have discovered that although you can integrate your Inventory Items into Desk as a "Product", it serves no real functionality.  In fact, I found the concept confusing compared to how many Service
    • Access custom view for Boards module - Qntrl Android app update

      Hello, everyone! In the latest Android version(v3.0.8) of the Qntrl app, we have brought in support to access the custom views for the Boards module. You can also mark a view as favourite by tapping the star icon next to the view name. The views that
    • Update Comment Field via Macro

      Is there a way to update the comments in a ticket, via a macro? I see how to update the resolution via macro, but I cannot see a way to update the comments. Am I missing something?
    • Two Accounts on a deal

      I have Reseller accounts that generally Purchase and End-user accounts that I need to track. When I lookup a Deal, I need to see both - easy enough. When I lookup one account or the other, I need to see the deal, but I can only see it in one. How do I
    • Auto-assign ticket to the agent who closes the ticket

      Hello Everyone! Here we are again, introducing a custom action to help you track tickets more efficiently and optimize your business operations. Imagine managing hundreds of tickets related to banking activities, similar to Zylker Bank. How do you ensure
    • Jiraa to Zoho Projects

      I am integrating Jira tasks into Zoho Projects using Zoho Flow, but I need to translate the Jira task names into English during the integration process. I attempted to use Google Sheets as an intermediary, by applying the Google Translate formula, but
    • Create Report/Query table from multiple Databases

      Is it possible to create a Report/Query table from multiple databases? example: SELECT "Date", "Time" FROM dbo.database1.thisTable INNER JOIN dbo.database2.thatTable ON dbo.database1.thisTable.date = dbo.database1.thatTable.date
    • Zoho Books | Product Updates | November 2024

      Hello users, We are back with exciting new features and enhancements in Zoho Books. From multi-criteria workflows to writing off customer opening balances, discover the new updates designed to make your bookkeeping swift. Attach XRechnung to Invoices
    • Tax Updates Revert on Zoho CRM Invoices After Running Custom Function

      Hi everyone, I'm running into an issue with Zoho CRM that I hope someone here can help me troubleshoot. I've created a custom function to update the tax amount on invoices in Zoho CRM. Initially, the function runs successfully and updates the tax field
    • No duplicates in lookup field

      I have a lookup field that is based on items from a material report. The problem is, there are a lot of duplicate material names for the particular field that it's based on. Is there any way to limit it to only show one of each item?
    • Lookup field based on another lookup field

      So I have a material entry form with a lookup field to an unrelated form in it. I have another form with a lookup field that shows records from the material entry form. The issue is, I want to set the the lookup field in the second form to be based on
    • Subform Client Script

      Good day,  I have a subform where users can subscribe to various magazines. I would like to prevent the user from selecting the same magazine twice when adding a new row. Is there a way to prevent the user from doing this? (Can it be done via a client
    • How to send emails from a ticket via deluge script

      We are planning to send an email from a ticket via deluge script how can we do that?
    • Using Snippets in Comments

      One of our Agents asked about using snippets in comments. We don't see this as an option at this time, only in reply mode. Is there a way to enable this?
    • 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.
    • New in Writer: Create personalized documents with Bigin!

      Hi everyone, We're excited to announce that Bigin now integrates with Zoho Writer as a data source for mail merge templates. This opens up new possibilities for generating personalized invoices, contracts, emails, letters, and other documents. Streamline
    • Next Page