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

    • Automating Employee Birthday Notifications in Zoho Cliq

      Have you ever missed a birthday and felt like the office Grinch? Fear not, the Cliq Developer Platform has got your back! With Zoho Cliq's Schedulers, you can be the office party-cipant who never forgets a single cake, balloon, or awkward rendition of
    • Accounting on the Go Series-55: Seamlessly Add New Vendors While Creating Transactions from Scanned Documents

      Hi there! We’ve made handling documents and vendors in Zoho Books even simpler. Now, when you upload a document and scan it, if the app detects a vendor that isn’t already in your organization, you don’t have to leave the page to add them manually. With
    • Surpress Zoho warnings in Customer Portal

      I'm experimenting with the Customer Portal. When I log in as a customer, this message shows up, completely covering the menu bar at the top. Can such messages be surpressed? I know, it is very easy to get rid of it, but when I demonstrated the portal
    • Default Sorting on Related Lists

      Is it possible to set the default sorting options on the related lists. For example on the Contact Details view I have related lists for activities, emails, products cases, notes etc... currently: Activities 'created date' newest first Emails - 'created
    • Send email to all contacts related to a module

      My use case: I have a module named products, the records of which contains a related list of contacts associated with subscribing to that product. In cases where i need to trigger emails manually to give specific unprecedented updates of that product,
    • Function #28: Automatically calculate Customer Loyalty points

      Hello everyone, and welcome back to our series! Today, we're excited to share a workflow designed to streamline the management of loyalty points. Many businesses offer incentives or rewards in the form of loyalty points to their customers as a way to
    • Custom Modules Support for Zoho Creator Integration

      The title says it all. We have to create custom coded widgets for every little thing because this is not supported. Zoho Creator does not support custom modules. Zoho Forms does not support Multi-select-lookups. The point of Zoho is to not have to code
    • C# SDK net8.0 compatibility

      The NuGet packages seem to be targeting .net4.6.1 only. Are there any plans to target .net8.0, which is the current LTS version? Which package should I be using to interact with the API when targeting .net8.0, if any? If the SDK does not readily support
    • Notifications

      I am facing a problem with notifications, the mobile crm app does not notify me at all for any mail, task, activity, ... etc., the web is slightly better as i can see a notification on the bell icon however with a delay from real time and without a sound,
    • Disable All

      I want to disable all the fields on the form when it loads.  I know there is a way to do this by listing all the fields as follows: disable Name; disable Address; disable City;  ... I have over 50 fields on my form and i am wondering if there is a single command or way to just disable all fields on load.   On load = disable All Thank you for any help.  
    • Zoho Mail - CRM Widget

      When I click on Associate this email to a contact within the CRM widget, I get "Oops! Something went wrong". This happen when I try to associate an email in a shared mailbox. The widget detect correctly the contact and show his informations from the CRM
    • Kanban View for Projects.

      At our organization, we describe active projects with various statuses like "In Proofing" or "Printing" or "Mailing". In the Projects view, one can set these project statuses by selecting from the appropriate drop-down. While this works, it's difficult to view and comprehend the progress of all of your projects relative to each other in a table. Creating a Kanban view for projects where I can move them from one status to another allows me to see where each project is in the order of our workflow.
    • Feature request - export as video

      Export presentation as video. I think that it would be super useful for many users. Thanks
    • Display Company Logos in Pipeline View

      To improve deal management and enhance usability, we propose adding the option to display the associated company's logo directly in the pipeline view. Currently, users can only see the deal owner's avatar, but having the company's logo would make it easier
    • Attention: Scheduled Maintenance at US DC on Dec 19, 2024

      Dear Bookings users, We would like to inform you that we've scheduled maintenance activity at our US data centers on Thursday, December 19th, 2024, from 5:30 PM to 5:45 PM PT. During this period, Zoho Bookings will be completely unavailable for the accounts
    • StatusIQ

      Please add StatusIQ to data sources. We using site24x7 and StatusIQ together and site24x7 integration is already there. Thanks and regards, Torsten
    • Set Display for Numbers/Currency/etc with Client Script/Customization in Canvas List Page

      Is it possible to set a display mask for a number/currency field using Client Script or customization? I have custom fields that I would like to keep the decimal places for calculation purposes, but do not need them displayed to the user. So 101.3568
    • Cross module filtering is now supported in CRM

      Editions: All DCs: All Release plan: This enhancement is being released in phases. It is now available in AU, JP, and CN DCs. Help resource: Advanced filters While the feature is being released in phases, you can also request for Early Access. Early Access
    • Filter Criteria - Default Option for text fields should be "Contains" and not the current default "is"

      When in a list view and filtering by an input text field it would be a lot more helpful to have the default criteria be "contains" instead of "is". The "is" criteria is too specific and I'm forever changing it to "contains" in order to use the filter
    • Getting email status through api

      Refer to code below for getitng status of mail sent through CRM any modules. You can get the subject as a key in each response, so if you want to filter a specific email you just put an if condition for that. Note that the status will be given as a JSON
    • How to refresh/update module fields in

      Hi, I created a Workspace for CRM years ago. Since that time I've updated the layouts in several modules in CRM but Zoho Analytics displays the previous state fields only. How to refresh the module fields to reflect the actual state in Analytics? BR
    • Présentation d'une nouvelle fonctionnalité de webinar à la demande

      De nos jours, les gens s'attendent à un accès instantané aux informations et aux ressources, qu'il s'agisse de divertissement en continu ou d'apprentissage en ligne. Conscients de cette évolution, nous sommes ravis de vous présenter une nouvelle fonctionnalité
    • An accurate email totals report

      DOes anyone know how to create an email totals report that actually works? I am running the outlook integration and if I count the actual total number of emails that I sent last month, it is ten times higher than what zoho reports.
    • Settings - Time Display 12-hour vs 24-hour

      Hi All This is probably a question for developers as it only seems to be an issued on applications published from Developer account to client accounts. Usually a client would update how they want to view their time (12-hour vs 24-hour) in the Settings
    • AMP HTML in Email Templates on Zoho CRM?

      Hello Team! Is it possible to add AMP HTML features to the email tempalte in Zoho CRM? Im using an external service to create tempaltes and they provide me with AMP HTML features, or dynamic HTML modules. But when I try to add them to the Email template
    • Error : Bin Locations Provided are not valid

      1. We just moved our data from the US to Indian Data Center 2. Now, in one of my organisations, I am unable to save invoices or purchase bills for items and it shows an error 3. Irony is, we dont' even use Zoho Inventory. Operations are completely on
    • [FREE LIVE WEBINAR] Maximize the impact of your marketing campaigns using a centralized Brand Studio

      Hey everyone, We're introducing a free live webinar on Zoho Marketing Plus entitled Maximize the impact of your marketing campaigns using a centralized Brand Studio. The main agenda of the webinar is to give you a complete overview of how Zoho Marketing
    • Trouble Creating Basic Chart for Accounts - past 6 months

      We run a sports performance gym, and I want to create a chart to track member growth, by month, over the last 6 months or so. We group members under the Accounts module (e.g. a family of 4 contacts has 1 billing account). Accounts are termed "Active"
    • Possible to pause/control the data refresh schedule for data visualisation triggered from custom button?

      In a module record view, I have created a custom button action to show a data table view from Zoho Analytics, using https://help.zoho.com/portal/en/kb/crm/customize-crm-account/custom-links-and-buttons/articles/custom-buttons. I noticed that the view
    • Sorting a list of record acquired from the zoho.crm.searchRecords function.

      This is something for which I'm trying to figure out a straightforward way to do. The searchRecords does a great job fetching me the records that I want. However, in some cases, where it returns multiple records, I want it to sort the returned list by date of creation of that record, so that when I do records.get(0), I get the most recent record.  As an example, here's my sample pseudo code: records = zoho.crm.searchRecords("Clients", "Office_Number:equals:123456"); Now the "records" list above contains
    • Creating cadences Unable to save

      Hi, I'm creating a cadence for sales based on the leads module I have email templates in a folder "sales Cadence emails" when I add follow up 1 I select the email address of the user the cadence is for but it won't save....why not? Moderation Update (2nd
    • Tab order for custom phone fields.

      Our Lead records utilize multiple custom phone fields, appearing in multiple sections. The tab order has been configured from top to bottom for each section. When users create a new record, or edit one in a way that makes a custom phone field appear for
    • How Can i put a form in Zobot

      Hi,how can i integrate a form which has a multiple options to choose from.the form should be opened or displayed by zobot after it meets a requirement in the conversation. Thanks in advance !
    • Sales IQ needs to capture both first and last names

      Sales IQ chat only has one field for name. When this then syncs with Campaigns, the field populates the "last name" field in Campaigns. However most people fill in the "name" field of Sales IQ with either their full name or their Christian name. This
    • Export PDF from Zoho Books via API

      Hi, I'm trying to export a PDF of all the invoices from a customer in Zoho Books via API. I'm doing it this way: $url = 'https://books.zoho.com/api/v3/invoices/pdf?'; $token = "xxxxxxxxxxxxxxxxxxxxx"; $org_ID = "xxxxxxxx"; $invoice_ids = "6289710000XXXXXXXX,62897100000YYYYYYY"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url . 'authtoken=' . $token . '&organization_id=' . $org_ID . '&invoice_ids=' . $invoice_ids); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER,
    • is there a way to tag the form rule? so that the email workflow can be sent through zoho begin for that perticular response?

      I have a form rule; based on which the response like a program to be sent via begin workflow. How do i do that?
    • Zoho Writer page break in a merge repeating region always adds an unwanted blank page

      Hi I'm merging a Zoho CRM record to a Zoho Writer document with a repeating region to display subform records on their own page within the document. When I try to insert a page break in a repeating region, the resulting merge always adds an unwanted blank
    • Introducing bot filtering for accurate analytics

      Dear Zoho Campaigns Users, We're happy to introduce bot filtering to enhance the accuracy of your email campaign analytics. This new feature is designed to help you filter out bot-generated opens and clicks, which will ensure your campaign reports reflect
    • Is there a way to add clients who don't have organisation in Zoho Books/Payroll/Expense ?

      The Zoho Practice software is only allowing a total of 15 such clients who are not organisations in Zoho Books/Payroll/Expense. i.e. 5 organisation in each of the software by creating a new organization for them and adding the accountant as the admin
    • Zoho Mail POP & IMAP Server Details

      Hello all! We have been receiving a number of requests regarding the errors while configuring or using Zoho Mail account in POP/ IMAP clients. The server details vary based on your account type and the Datacenter in which your account is setup. Ensure
    • Next Page