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

    • Creating Email template that attaches file uploaded in specific field.

      If there's a way to do this using Zoho CRM's built-in features, then this has eluded me! I'm looking to create a workflow that automatically sends an email upon execution, and that email includes an attachment uploaded in a specific field. Email templates
    • How to create a Field with answers as Yes, No> Further if no is selected a new field to be visible to give details

      Dear All, I am creating a feedback form in HR Letter. The question is were you satisfied with the work allotted. Expected answer to this is Yes, No. Further if the response is no, then a field to be give to fill more details as to why no was selected.
    • Filter Tabs in a Dashboard

      I have multiple tabs in a dashboard one of which is aimed at a different audience, is it possible to filter out this tab for a group of users?
    • How do I set up Contact Scoring for my existing contacts

      I'm trying to set up Contact Scoring for my subscribers, 9 months after creating the database. I've added the Campaign Activities, but none of the contacts have a score. How can I update all the contacts so they show a score? My goal is to ultimately
    • ZOHO PEOPLE

      HOW CAN I DELETE LEAVE HISTORIES IN ZOHO PEOPLE?
    • Kiosk Studio: Function FIX for Date/Time Field (Keep getting wrong format error)

      I am using the foillowing function in my Kiosk Studio to update the previously entered Date/Time field from previous screen to update that to the same date/time field in Lead Record. Every time I 'Save & Execute' I get a Success but with 'Date/time Format
    • Zoho CRM Web To Lead Form: Radio Buttons/Pulll Down Menus?

      Hi is there a way to set up radio buttons, check boxes or pull down menus in the web to lead form? We often ask additional lead qualifiers or demographics information and in some cases radio buttons or pull down menus are necessary or more efficient to
    • 5名限定 課題解決型ワークショップイベント Zoho ワークアウト開催のお知らせ (10/31)

      ユーザーの皆さま、こんにちは。Zoho ユーザーコミュニティチームの藤澤です。 10月開催のZoho ワークアウトについてお知らせします。 ━━━━━━━━━━━━━━━━━━━━━━━━ Zoho ワークアウトとは? Zoho ユーザー同士で交流しながら、サービスに関する疑問や不明点の解消を目的とした「Zoho ワークアウト」を開催します。 Zoho サービスで完了させたい設定やカスタマイズ、環境の整備など……各自で決めた目標達成に向け、 他の参加者と同じ空間で作業を行うイベントです。先輩ユーザーや他の参加者と意見交換をしながら集中して作業に取り組むことが可能です。
    • Is Drawing feature supported in zoho Sheets?

      Is there any option to draw arrows and some basic shapes such as circle , rectangle etc in zoho sheets? if so, can someone help me find it 
    • Zoho Meetings - Scheduling sucks

      I wanted to try this out for our little meeting group. I scheduled the meetings for Tuesdays, Thursdays and Fridays. No matter what I did, the meetings all showed on FRIDAY. I changed the date and hit save. Still friday. Terrible system. Back to Zoo
    • This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details

      Hello, Just signed up to ZOHO on a friend's recommendation. Got the TXT part (verified my domain), but whenever I try to add ANY user, I get the error: This user is not allowed to add in Zoho. Please contact support-as@zohocorp.com for further details I have emailed as well and writing here as well because when I searched, I saw many people faced the same issue and instead of email, they got a faster response here. My domain is: raisingreaderspk . com Hope this can be resolved.  Thank you
    • Brand New and have some questions

      Hi everyone. I am brand new to Zoho and have some questions I need help with. 1. I just imported a bunch of contacts and most of them don't have any association with an account. However, an account is required to add them to pipelines it seems. Can I
    • Zoho very poor support!

      More then 1.5 week ago I've contacted Zoho support by email and STILL no reply. What kind of business are you people running? I'm a paying customer and I demand support. Your email service is blocking valid emails from my business partner because of  "we generally do not accept emails from dynamic IP bla bla bla" I, NOT YOU, decide which emails I want to receive. I don't need your crap email protection. If I want spam protection I'll implement it myself. I've put his domain on the whitelist and STILL
    • Immediate action required by Notification SMS users

      Attention dear customers, This announcement seeks immediate action by CRM Notification SMS users to update their telemarketer aggregator for notification SMS compliance. We would like to bring to your attention an important update in the Telecom Regulatory
    • Import subform entries conveniently in CRM

      Dear All,   Subforms have always been crucial for associating additional data with CRM records. You can easily associate line items with parent records and keep track of various details related to your records. We're pleased to announce that we've introduced
    • Pay milage expense with undepositied cash

      Hello When I add millage, the only probable option to "pay through" is Owner's Equity. I pay for the fuel using undeposited cash but I can set "paid through" to undeposited funds while entering mileage. I do not have employees and this is the mileage
    • This domain is not allowed to add. Please contact support-as@zohocorp.com for further details

      I am trying to setup the free version of Zoho Mail. When I tried to add my domain, theselfreunion.com I got the error message that is the subject of this Topic. I've read your other community forum topics, and this is NOT a free domain. So what is the
    • Involved account types are not applicable when create journals

      { "journal_date": "2016-01-31", "reference_number": "20160131", "notes": "SimplePay Payroll", "line_items": [{ "account_id": "538624000000035003", "description": "Net Pay", "amount": 26690.09, "debit_or_credit": "credit" }, { "account_id": "538624000000000403", "description": "Gross", "amount": 32000, "debit_or_credit": "debit" }, { "account_id": "538624000000000427", "description": "CPP", "amount": 1295.64, "debit_or_credit": "debit" }, { "account_id": "538624000000000376", "description":
    • Inconsistent "Happiness Rating" Percentage

      When searching through the list of customers, the Happiness Rating percentage that shows for one particular customer of ours is 71%. However when going into that customer, the percentage shows as 100% (which we think is correct as we can't find anything
    • Zoho Desk - how to see date ticket created?

      We have migrated from Help Scout and are a customer service team, not a technical ticket team. (i.e. we don't have 'due in X hours' needs) We are accustomed to seeing the date the customer sent the email / ticket received. I don't see a way to display this very basic information in the Views. Please assist with how to display this.
    • Not able to create a new, second help center

      Hi. I'm not able to create a new, second help center. How can I solve this problem?
    • Contacts and Accounts views support and Ticket details screen UI enhancement - Zoho Desk Android app update

      Hello, everyone! In the latest version(2.7) of the Zoho Desk Android app update, we have covered the following features: Contacts and Account views UI enhancement in the Ticket details screen IM icon display Contacts and Accounts view You can now access
    • Enable 'drag & drop' upload of files to Purchase Receives

      Zoho has enabled drag and drop functionality for sales orders and purchase orders in Zoho Books. Currently this functionality is not enabled for Purchase Receives, which require you to "upload your files" via the file manager rather than simply dragging
    • Unbilled Items Report?

      Hello! Is there any way to display a list of items that remain unbilled, without creating an invoice for each customer to see if the unbilled items box is displayed? ;-) Ben
    • SSL Certificate Error - Connection is not secure

      I am new to Zoho Desk, but I've tried to link our new Zoho helpdesk to our domain via the subdomain https://helpdesk.leannova.de It appears the CNAME change we implemented is working, but we're getting an SSL error that looks like this: *********************************** Your connection isn't private Attackers might be trying to steal your information from helpdesk.leannova.de (for example, passwords, messages, or credit cards). NET::ERR_CERT_COMMON_NAME_INVALID This server couldn't prove that it's
    • Log when ticket is moved to a different department

      Hello, is there a way that I am able to log when and who moved a ticket from one department to another? I tried looking at workflows and I can't find any way to log a history when a ticket's department is changed. It would be great if this data could
    • SMTP Error: Could not authenticate.

      Hi team! Trying to send email throu PHPmailer. Im using smtp.zoho.eu, TLS with port 587. Username: alex@aljon.nu Password: *********** (well, my login password). This is the error: 2017-12-19 13:06:49 SERVER -> CLIENT: 220 mx.zoho.eu SMTP Server ready
    • 554 5.2.3 MailPolicy violation Error, help?

      This message was created automatically by mail delivery software. A message that you sent could not be delivered to one or more of its recipients. 554 5.2.3 MailPolicy violation Error delivering to mailboxes I am not sure why i am getting this, please
    • Recover trash emails deleted by Zoho

      Three times in the past 6 weeks all emails have been deleted from trash. I have NOT accidentally deleted them myself--they literally disappear before my eyes. I have the trash folder set up to delete items after 30 days, but they have suddenly ALL disappeared
    • ERROR:554 5.1.8 Email Outgoing Blocked.

      Buen día Tengo un problema con una de mis cuentas de correo corporativo, investigue sobre el error, borre mensajes y el problema persiste. No se como puedo desbloquear mi cuenta de correo. El correo en cuestión es dinagramascentro@servicioslatinosltda.co
    • ME SALE ESTE ERROR: No fue posible enviar el mensaje;Motivo:554 5.1.8 Email Outgoing Blocked

      Ayuda!! Me sale este error al intentar enviar mensajes desde mi correo electronico de Zoho! Tampoco recibo correos pues cuando me envia rebotan. Ayuda, Me urge enviar unos correo importantes!! Quedo atenta MAGDA HERNANDEZ +5731120888408
    • Custom Button in Shipments

      Custom buttons feature is very much needed in shipments. Please work on this feature request!
    • Zoho mail is logging me out almost every day ?

      Yes I have clicked the Remember Me option. Yet I need to login again every 1 - 2 days, sometimes multiple times per day. The saved credential does not persist.  Using fairly clean Chrome.
    • Asap Widget 2.0

      Where's the documentation for the new ASAP widget? https://www.zoho.com/desk/developers/asap/#introduction this one is outdated How can we dynamically navigate between different views? How can we prefill ticket forms using ASAP 2.0?
    • DataPrep Bigquery Connection failed

      Hello everybody, I want to create a connnection beetwen Bigquery and Dataprep but when I try to connect my project I got this error Loading tables has failed. Table list fetched from the data source expired.
    • Can I add Conditional merge tags on my Templates?

      Hi I was wondering if I can use Conditional Mail Merge tags inside my Email templates/Quotes etc within the CRM? In spanish and in our business we use gender and academic degree salutations , ie: Dr., Dra., Sr., Srta., so the beginning of an email / letter
    • Organization-Tiered Support in Zoho Corp Help Center

      Dear Zoho Team, Greetings! As the focal point for all Zoho-related matters in our organization, we would like to request the implementation of an organization-tiered support structure in the Zoho Corp Help Center (Zoho's internal Zoho Desk). This feature
    • HTTP Error 500 when creating E-Mail Draft with API

      Hi, I tried to create an email draft for a ticket using the Zoho Desk API (v1); however, I continuously receive HTTP Error 500: An internal server error occurred while performing this operation. I've tried both curl and Python implementations, but neither
    • Recording overpayment?

      So a customer just overpaid me and how do I record this? I can't enter an amount that is higher than the invoice amount. Eg. Invoice is $195 and he sent $200. He's a reccuring customer so is there a way to record so that he has a $5 advance for future invoice?
    • Function #10: Update item prices automatically based on the last transaction created

      In businesses, item prices are not always fixed and can fluctuate due to various factors. If you find yourself manually adjusting the item rates every time they change, we have the ideal time-saving solution for you. In today's post, we bring you custom
    • Next Page