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

    • Address Autofill

      Hi I'm having issues with the address autofill tutorial (https://zurl.co/rGXQ). I have followed each step in the tutorial, but when i paste the code into a workflow/function, i'm getting the following error code: Improper code format Correct format :
    • Sync custom module ID to Lead module

      Hello, I am trying to sync Contract ID (custom module) from Deal module. I have an existing function that whenever a contract is created, it will automatically creating deals based on the frequency of the contract. Now i am having problem to show the
    • In Kiosk, please support "File upload field" in the "Field Update" action

      Hello. Supporting "File upload field" in the "Field Update" actions would be a great addition to Kiosk Studio. I would appreciate it if you could evaluate it. Saludos,
    • can I link a contacts to multiple accounts

      can I link a contacts to multiple accounts
    • Change Last Name to not required in Leads

      I would like to upload 500 target companies as leads but I don't yet have contact people for them. Can you enable the option for me to turn this requirement off to need a Second Name? Moderation update (10-Jun-23): As we explore potential solutions for
    • For security reasons your account has been blocked as you have exceeded the maximum number of requests per minute that can originate from one account.

      Hello Zoho Even if we open 10-15 windows in still we are getting our accounts locked with error " For security reasons your account has been blocked as you have exceeded the maximum number of requests per minute that can originate from one account. "
    • Zoho Creator - Zoho Analytics

      I am facing an issue in Zoho Analytics where I am still seeing deleted data from the Zoho Creator form I created. Could you please look into this and let me know what needs to be done?
    • The Social Wall: November 2024

      Hey everyone, As we move into December, we're excited to share all the updates that went live in Social during November. View, monitor, and respond to your WhatsApp and Telegram messages from Inbox Take your communication a step further by integrating
    • Launching CPQ for Zoho CRM! An in-built solution for bespoke quote management

      Hello everyone, We are thrilled to announce the public release of CPQ (Configure, Price, Quote) for Zoho CRM, which is a fundamental block in sales management. NOTE: CPQ was a public early access feature from March 2023 — January 2024. Since February
    • Add an action to set agent as a member of a team in zoho desk

      Hi, Please add an action to zoho flow to set agent as a member of a team in zoho desk (add to a team or remove from a team). Regards, Ram
    • Power of Automation :: Automatically set the dependency between Parent task and the respective sub tasks

      A custom function is a software code that can be used to automate a process and this allows you to automate a notification, call a webhook, or perform logic immediately after a workflow rule is triggered. This feature helps to automate complex tasks and
    • Registration in community

      Namaste I am from Shimla, But there is no option selection of shimla.
    • Spell Check default language

      Hello All, Is it possible to set the Spell Check default language? I can't find it in the settings. Thanks a lot! Levente
    • Function #4: Schedule Customer Statements

      Regularly sending statements to customers is an imperative part of many business processes as it helps foster strong customer relationships and provides timely guidance on payments. While you can generate the statement of accounts and have it sent over
    • Music files on Zoho Docs

      1) Uploaded a ma3 music file from Itunes.  When I click on the link, i go to the page and see a music player but it doesn't play.  Clicking on the play arrow does nothing.  How to fix???? 2) Also, when i put up a .zip file  and goto the page, anyone download it.  That's fine. But with a music file, all I get is that non functional player with no way to simply download the song. Do I have to zip every song so it can be downloaded?
    • 5名限定 課題解決型ワークショップイベント Zoho ワークアウト開催のお知らせ (12/19)

      ユーザーの皆さま、こんにちは。Zoho ユーザーコミュニティチームの藤澤です。 12月開催のZoho ワークアウトについてお知らせします。 参加登録はこちら: https://us02web.zoom.us/meeting/register/tZAqdOCrrDMtGdL3w__UraUPaZxJpeS_wcyt ━━━━━━━━━━━━━━━━━━━━━━━━ Zoho ワークアウトとは? Zoho ユーザー同士で交流しながら、サービスに関する疑問や不明点の解消を目的とした「Zoho ワークアウト」を開催します。
    • Restrict Employees Access to Zoho Support

      Dear Zoho Support Team, Greetings! I am the focal point for all Zoho-related matters in our organization, and I would like to request the following features to help us streamline and centralize our support interactions. We request that zoho one support
    • How to import timesheets or entries into a projecgt

      How can one import timesheets into a project via a csv file?
    • Automatic License Management Upon User Deactivation in Zoho One

      Dear Zoho Team, We would like to propose a feature enhancement for Zoho One regarding license management. Currently, when a user is deactivated, their license is not automatically downgraded or removed from our account. Zoho explains this behavior by
    • Shared Snippets Everyone

      Hi, Now that the Shared Snippets have been released and I think will be the most used feature implemented in 2023 :) Creating and Using Snippets in Ticket Responses - Online Help | Zoho Desk Maintain consistency in ticket responses with shared snippets
    • Introducing parent-child ticketing in Zoho Desk [Early access]

      Hello Zoho Desk users! We have introduced the parent-child ticketing system to help customer service teams ensure efficient resolution of issues involving multiple, related tickets. You can now combine repetitive and interconnected tickets into parent-child
    • How to suppress display of "USD" of currency field?

    • When is Zoho Vault getting fuzzy search?

      Seeing posts on here dating back as far as 3 years complaining about Vaults search functionality. It’s terrible. Please include fuzzy search, and sorting of results according to “most applicable”; not just alphabetically.
    • Automation#22 Track Ticket Duration at Specific Status

      Hello Everyone! Welcome back to the Community Learning Series! Today, we explore how Zylker Techfix, a gadget servicing firm, boosted productivity by tracking the time spent at a particular ticket status in Zoho Desk. Zylker Techfix customized Zoho Desk’s
    • Self-Support Portal invites

      I'm a one man operation and I'm using the free version of the Zoho Desk for now, but I am in need of help. When I do test tickets, I get a reply from the system inviting me to join the Self Service portal. I don't plan on using that, so I wonder if there
    • Lookup field in User module cannot look up to custom modules!

      Hi there, Expense has been great so far but it's sad to see that a simple thing such as allowing a lookup to custom modules from the Users module is not yet implemented. Hope to see this in the next release. Do you have any plan for that?
    • Tip #10: Automatically add tags to Zoho CRM records using form responses

      You may be using tags to filter records, create reports based on specific tags, or let your sales team to know which clients to give priority to. Don't skip tagging for the crm records added via forms. The tags can be set to be automatically captured during the form submission. How it works When you set up a configuration to push form entries into CRM, you can add a tag to them automatically. The tag value can vary based on the respondent's input (captured using form fields), or you can include a
    • Understanding response time

      We have the following set up for our SLA. When a contact first writes in, the response due and resolution due dates are set. When one of our agents responses, the response due goes away. When a ticket gets a response from the contact, it appears to reset
    • Publish multiple languages at once in Knowledge Base

      Does anyone know if it is possible to publish multiple translated articles at the same time? My knowledge base has about 35 languages, and while I have them set up to automatically translate, I still have to go in and select each language and manually
    • Canvas and Related lists

      Hi, As much as I like canvas, when adding in a asection with related lists,it doesnt mimic the same functionality as the standard view within the CRM e.g left hand panel will show the module and total number of records. Is there a way of indicating this
    • Email address ZOHO suggestions in replying - how to delete unwanted suggestions?

      Hi, I have some "unwanted" email addresses suggestions by ZOHO, and made some mistakes by replying for some tickets already. How can I clear this in ZOHO directly, I deleted all web browser history and cookies . Did not help :/ Below example, where one
    • Copy Widget to another Dashboard

      I can see the option to clone a widget to the same dashboard but is it possible to copy it to another dashboard?
    • Subform edits don't appear in parent record timeline?

      Is it possible to have subform edits (like add row/delete row) appear in the Timeline for parent records? A user can edit a record, only edit the subform, and it doesn't appear in the timeline. Is there a workaround or way that we can show when a user
    • CRM x WorkDrive: File storage for new CRM signups is now powered by WorkDrive

      Availability Editions: All DCs: All Release plan: Released for new signups in all DCs. It will be enabled for existing users in a phased manner in the upcoming months. Help documentation: Documents in Zoho CRM Manage folders in Documents tab Manage files
    • Zoho Learn vs. Trainer Central

      Hi, I'm currently using Zoho One with a WordPress-based website and WooCommerce to manage my online courses. I would like to know what is the difference between Zoho Learn and Trainer Central and if it's possible for these two platforms to replace WP
    • How to Display a Logo Image on a Public Form?

      I would like to display a logo image in the header of a form. To achieve this, I added an Add Notes field to the form. The code below works perfectly for Zoho users accessing the form. However, when the form is made public, the image does not load properly:
    • Creating a Zoho Online Meeting in a Blueprint

      We are looking for an easy solution to schedule online meetings in a blueprint and ran into the same problem discussed in this topic: https://help.zoho.com/portal/en/community/topic/custom-function-to-set-meeting-to-online-meeting (After connecting Zoho
    • Enabling 'From Number' and 'To Number' fields in the Calls module

      Hello everyone, We've added "To Number" and "From Number" fields in the Calls module as part of our latest update to provide users with the option to enable or disable them through the Calls Preferences tab. When enabled, these fields will be displayed
    • Exciting Update: Multi WhatsApp Business Account (WABA) Support Now Available in SalesIQ!

      We’re pleased to share an important update that will enhance the way you manage your WhatsApp Business accounts (WABAs) within SalesIQ. With the launch of Multi WABA support, you can now connect and manage multiple brands more effectively, each under
    • Route Optimizer

      Does Zoho Inventory offer route optimization for our in-house deliveries? It will save us time to manually route our daily orders. Thank you
    • Next Page