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

    • [Résolu] Liste dynamique dans Creator

      Bonjour, Dans Zoho Creator j'aimera pouvoir afficher une liste en fonction d'une donnée choisie dans une autre liste. Explication : J'ai un formulaire Département avec comme champ : Nom J'ai un formulaire Personnel avec comme champs : Nom et 'lookup'
    • PDF Document creating, editing, digital signing?

      Any chance you could provide PDF creating, editing,signing?  Or perhaps integrate with http://www.pdfescape.com/ ?   thanks, Linda
    • [Zoho Writer Webinar] Learn how to simplify your HR operations: Part 2

      Hi Zoho Writer users, We're excited to announce the Zoho Writer webinar for July 2024: Learn how Zoho Writer can simplify your HR operations: Part 2. This webinar will focus on how Zoho Writer can help HR teams streamline and automate their entire hiring
    • Pay in USD

      Hi, is it possible to pay in USD instead of EUR? Thanks.
    • Stock function not working for Brazil (Bovespa)

      Hi, The STOCK function in not working for the Brazil Exchange "Bovespa". This is the syntax I´m using: =STOCK("Bovespa:BBAS3";"PRICE"). Thanks for any help. Ale
    • Tablet Pencil + Fillable Form

      Hi There, I just started using Zoho Writer Forms for our team on iOS. I noticed that some functions support 'scribble' or tablet pens and some do not. Is there a function I am missing where any text field can support 'scribble' or handwriting/printing
    • Announcing new features in Trident for macOS (v.1.10.0)

      Hello everyone! Trident for macOS (v.1.10.0) is here with major features and enhancements to elevate your workplace communication and productivity. Let's take a quick look at them. Create tasks from emails. In addition to creating tasks from selected
    • Journey : "Added to segment" trigger doesn't work automatically

      Hello, I’m experiencing an issue with our Marketing Automation 2.0 integration with Zoho CRM. We have multiple segments defined in Marketing Automation, each with criteria based on field values synced from Zoho CRM. If a field value changes in Zoho CRM,
    • Two way sync Zoho Mail and Bookings

      Hi, I know it’s possible to view Bookings appointments in Zoho Mail, but is there a way to see my Zoho Mail meetings in the Bookings calendar?
    • Assistance Required: Email Configuration Issues for Domain clearskyaerials.net

      Dear Support Team, I am experiencing issues with my email configuration after linking my domain, clearskyaerials.net, to Zoho Mail. I followed the DKIM setup guide and successfully configured it. While I can now send emails, I am unable to receive them.
    • How can I bulk import product images to Zoho crm.

      How can I import product images to Zoho crm within bulk imports. I am using an excel sheet or csv and want to include an image (via URL) for each product. This topic is the closest I have found to a solution but I need further help to implement it: https://help.zoho.com/portal/en/community/topic/import-file-upload-and-image
    • Can't send mail Reason:554 5.1.8 Email Outgoing Blocked.

      I send messages to my clients for my agency to my targeted clients last night I got (Unable to send message;Reason:554 5.1.8 Email Outgoing Blocked) this warning. Now I can't send mails. Please fix this issue.
    • erro 553 retransmitindo e-mails não permitidos devido ao domínio ou algo parecido

      Olá, não consigo enviar ou receber e-mails, pois mostra uma mensagem de erro 553 retransmitindo e-mails não permitidos devido ao domínio ou algo parecido.. Por favor, ajude-me a corrigi-lo. Obrigado.
    • How do I go to new form after using deluge button?

      I have (Form1) - [Report1] (Form2) - [Report2] I have created a button which appears on [Report1] which creates a new record for [Form2] using data from [Form1]. I have the script working well, it pulls the needed information from Form1 and builds a new
    • smtppro.zoho.como eror

      En nuestras cuentas de empresa desde hace unos dias estamos experimientando problemas con los correos IMAP outlook, generando un error en el smtppro.zoho.com 465 /SSL Todo estaba trabajando bien y sin problemas. Alguien mas con el mimo problema y/o encontró
    • Outgoing Email blocked

      Hi Support Team, My outgoing emails has been blocked, Appreciate your help to unblock it. Hartron Trade
    • How do I stop getting notified about upgrading to Upgrade now and save big!

      How do I stop getting notified about upgrading to Upgrade now and save big! There is no way to clear this notification, and EVERY Day I get alerted to upgrade, but there is no permanent way to dismiss this alert! How can I permanently dismiss this a
    • Sheet view ignores layout rules / How to restrict fields in sheet view

      Hi Problem 1: When editing records in sheet view, layout rules are ignored. This is a problem, because it allows users to ignore some mandatory fields (mandatory in a Layout Rule). (Mass Update does not allow updating of fields with Layout Rules, so why
    • Portal users embed access

      So I have a page with a form, and two reports on either side. The reports are embedded as html snippets. So basically, it's set up that when I select a material from the form lookup field, it reloads the report embeds but filters the records with the
    • Importing Accounts with Parent Accounts

      I would like to import accounts that contain parent accounts.  I see a Parent Account but do not see a Parent account number in the Zoho fields and will need this to make sure the correct unique parent is imported. Can you help explain how to accomplish this?
    • Merge item

      As a follow up on a request point raised 7 years ago I would like to submit an official request to enable a "merge item" option. Discussion: https://help.zoho.com/portal/en/community/topic/merge-items submitted by user 4001007559351 Our business has several
    • Canvas Fit to Screen

      Hi, is it possible to have the Fit to Screen tickbox unmarked as a default?
    • Duplicate Zoho Invoices and Sales Receipts

      We have been running into an issue where upon saving an invoice or a sales receipt, we get a duplicate: same information saved twice but with a different invoice id/number and sales receipt id/number. I have logged a ticket but so far no response. It
    • Banking - User Roles - Access To Single Bank Account

      Hi, We have different locations with each location having a specific bank account for Expenses/Etc... Can you please confirm on whether it's possible to give a user (non accountant), specific access to only a single bank account as opposed to all accounts
    • Zoho Account search not finding account even thought account is created

      Hi Over the last week I cannot find a account on a lookup field, the account exists as when I check in the module its there. Any lookup filter, in a lookup field fails to find the appropriate account, im not sure if you have a Regex issue but its clearly
    • How to send an alert when there have been no leads for 2 days

      Hello, I want to be alerted when there have been no new leads created for, say, 2 days. It seems like it should be a simple thing to achieve but I'm struggling. I tried asking Zia and this was the answer, but it doesn't fit what I'm seeing on the workflow
    • How to get bulk write to work as expected

      I need to move data from our systems into Zoho. I have created a sandbox to test the usage of migrating our data to Zoho and confirmed everything worked there. When attempting to do the same with our production CRM I was met with an error saying Zoho
    • Zoho Sign embedded iframe

      Hello, we are looking for any of these options: a) some iframe that we can paste into our website for every signer, for onpage signing document. b) or get direct link for signers from Zoho sign API which we can redirect manually. Is any of these options
    • SEO recommendation of H1 tag for website tittle

      The exact words are “ It is good practice to place the page title inside the H1tag.” Now I already have one H1 tag on my website but it is not website tittle. In the SEO recommendation that is clear too that I have h1 tag on my page. Now I don’t know
    • SIGNATURE FIELD INSIDE CRM MODULE

      I need to have a signature field inside CRM MODULE This can be used into my Post Sales Module that i´ve created to make Meetings Summary I need my client to sign this Meetings Summary during my visit and that ain´t possible with Zoho crm I know we have
    • email and username change

      HI, I'd like to change my email and username for my zoho store, please help me on this issue.
    • "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
    • Next Page