Extension pointers #6: Working with widgets to power up extension capabilities (Part-3)

Extension pointers #6: Working with widgets to power up extension capabilities (Part-3)

Widgets are useful for exchanging data between the third-party applications and Zoho CRM, as well as for displaying the data on a customized basis within Zoho CRM. They let you create customized UI interfaces that allow the data to be showcased through your own perspective. Embedding the widget in Zoho CRM helps to seamlessly synchronise the third-party application data into native CRM components and thereby perform certain functions using that data.

In our previous posts (Part-1 and Part-2), we covered the detailed steps involved in installing ZET CLI, creating a widget, associating it with a connected app, embedding it inside Zoho CRM, and hosting it. In this post, let's see a full-fledged example that demonstrates how widgets help you build powerful extensions.

We'll look at how you can use widgets to easily upload a document present on your desktop to a folder in Dropbox from within Zoho CRM. You can utilize the key benefit of widgets to personalize the UI according to your needs and implement this process. Design a UI interface using a widget that can be easily embedded into Zoho CRM, and let that UI enable you to choose a file from Desktop and upload it to Dropbox.

The steps involved to achieve the above mentioned functionality using widgets are as follows:

1. Create a connector to establish a connection between Zoho CRM and Dropbox in your extension
2. Create a widget that performs the file upload functionality (ZET CLI should have been installed—refer to Part-1)
3. Associate the widget with a Connected app and host it
4. Embed the widget inside Zoho CRM
5. Test your widget's functionality

Create a connector for Zoho CRM and the Dropbox integration

1. Go to the Extension's detail page in the Zoho Developer console.
2. Create a connector called "Dropbox Connector". Please refer to the post on connectors to view the detailed steps to create, publish, and associate a connector with an extension.



In our example, the connector details are as follows:

DropBox Token URLs required for creating a Connector
3. Create an API with necessary parameters to upload files from Zoho CRM to Dropbox.



In our example:

File upload Connector API details
Method Type
POST
URL
Headers
Refer DropBox API documentation

After creating the connector and adding the API, publish and associate it with the extension.

Build a widget to upload a file from Zoho CRM to Dropbox

Using ZET CLI, create a new project called "DropboxProject".



Add the necessary files:
  • HTML, CSS file—UI that will enable you to choose a file from your desktop
  • JS file—Includes the business logic to upload the chosen file and invoke the DropBox connector using API helpers provided by Zoho CRM's JS SDK
It's important to add the ZohoEmbeddedAppSDK.min.js file (available here) to use the JS SDK's that are needed for your project. Please refer to JS SDK to get information on the different Zoho CRM APIs supported by the SDK. These APIs are significant in helping the Javascript code interact with Zoho CRM.



dropbox.js code snippet

 var entity;
 var id
 var entityName;
 var record;
 Util={};
 // PageLoad listener that returns the entity details of the active page
 ZOHO.embeddedApp.on("PageLoad", function(data) {
 id = data.EntityId[0];
 entity = data.Entity;
 // Get the record details of the entity using the value returned by PageLoad listener
 ZOHO.CRM.API.getRecord({
 Entity: entity,
 RecordID: id
 }).then(function(data) {
 // Fetch the required details from the response obtained through getRecord API 
 var dataa = data.data[0];
 record=dataa.Full_Name;
 })
 })
 // The File Upload function fetches the file and uploads it to Dropbox  
 Util.uploadFile = function(){
 var file = $("#fileupload");
 //Fetch the file details
 var file = document.getElementById("fileupload").files[0];
 var fileType;
 if (file.type === "application/pdf"){
 fileType = file.type;
 }
 else if((file.type === "image/jpeg") || (file.type === "image/png")){
 fileType = file.type;
 }
 else if(file.type === "text/plain"){
 fileType = "application/msword";
 }
 else if(file.type === ""){
 fileType = "application/text";
 }
 var name = file.name;
 name = encodeURIComponent(name);
 //Construct the params required by the Dropbox upload API using the fetched details
 var data = { 
 "VARIABLES":{
 "module" : "Zoho CRM/"+entity, 
 "record" : record,
 "file_name": name 
 }, 
 "CONTENT_TYPE":"multipart", 
 "FORWARD_TYPE":"data-binary", 
 "FILE":{ 
 "fileParam":"content", 
 "file":file 
 } 
 }
 //Invoke DropBox Connector using invokeAPI
 ZOHO.CRM.CONNECTOR.invokeAPI("testextension97.dropboxconnector.uploadfileapi", data)
 }


The code snippet mentioned above invokes the "Dropbox Connector" to perform the file upload functionality. There are a few Zoho CRM APIs that are used in the above dropbox.js code snippet to perform the specified functionality. Let's have a look at it.

ZOHO.embeddedApp.on("PageLoad",function(data)) - An event listener that is triggered whenever an entity Page (Details Page) is loaded.

ZOHO.CRM.API.getRecord(config) - API that gets all details of a record when provided with the entity and record ID information.

ZOHO.CRM.CONNECTOR.invokeAPI(nameSpace, data) - API to invoke the connector API based on the namespace and data provided.
  • In our example, PageLoad listener is used to fetch the entity and ID of the record in active page. 
  • By passing the retrieved entity and ID to the getRecordAPI, the complete record information is gathered. 
  • Finally, the information (module, record, name, content type, etc) to be passed as data parameter to DropBox Upload API is extracted and passed to Connector.invokeAPI CRM API in order to invoke the connector. Along with this, the namespace is also passed as a parameter. (In our example, "testextension97.dropboxconnector.uploadfileapi" is the namespace for "Dropbox Connector.")
  • invokeAPI will invoke the Dropbox Connector and performs the File Upload functionality. 
On adding the necessary files, validate and run the widget project to check if it is running fine locally.



The localhost output on testing the widget using ZET CLI:



Finally, pack the project to obtain the packed and zipped file.



Associate the widget with a connected app and host it

Now that the widget is created, the next step is to associate the widget with a connected app and host it. 

1. Go to the Extension's detail page in the Zoho Developer console.
2. Click on Connected Apps from the left panel under Utilities.
3. Choose Internal Hosting. Zoho's servers are used to host an application internally.
4. Upload the "DropboxProject" zipped file from the dist folder of your project and click Save.




Embed the widget inside Zoho CRM

After successfully associating the widget with the connected app, the next step is to embed it inside Zoho CRM in the location you want to use it. Let's embed the widget into a custom button in our example.

1. Choose Components from the left panel of the Zoho Developer console under Build. Click Create New Button.



2. Choose Invoke a Widget as the action you'd like the "Upload File" button to perform. Add the location of the widget's HTML file along with the base sandbox URL and click Save.



Test the functionality of your widget locally in an isolated sandbox environment. It's important to keep the localhost server running while testing the sandbox. Run localhost by using the command "zet run" in the ZET CLI.

i. In the sandbox environment, choose the Contacts module and select a contact
ii. Click the Upload File custom button



iii. The Upload file widget will open
iv. Choose a file and click the Upload button



The file will be uploaded to Dropbox according to the path specified in the File Upload APIs Header.



As you see, using widgets, we could easily create a customized UI interface and exchange data across applications. You can customize and enhance your widget's functionality according to your requirements. For more information, keep following this space.


SEE ALSO







    Access your files securely from anywhere

          Zoho Developer Community




                                    Zoho Desk Resources

                                    • Desk Community Learning Series


                                    • Digest


                                    • Functions


                                    • Meetups


                                    • Kbase


                                    • Resources


                                    • Glossary


                                    • Desk Marketplace


                                    • MVP Corner


                                    • Word of the Day



                                        Zoho Marketing Automation


                                                Manage your brands on social media



                                                      Zoho TeamInbox Resources

                                                        Zoho DataPrep Resources



                                                          Zoho CRM Plus Resources

                                                            Zoho Books Resources


                                                              Zoho Subscriptions Resources

                                                                Zoho Projects Resources


                                                                  Zoho Sprints Resources


                                                                    Qntrl Resources


                                                                      Zoho Creator Resources



                                                                          Zoho Campaigns Resources


                                                                            Zoho CRM Resources

                                                                            • CRM Community Learning Series

                                                                              CRM Community Learning Series


                                                                            • Kaizen

                                                                              Kaizen

                                                                            • Functions

                                                                              Functions

                                                                            • Meetups

                                                                              Meetups

                                                                            • Kbase

                                                                              Kbase

                                                                            • Resources

                                                                              Resources

                                                                            • Digest

                                                                              Digest

                                                                            • CRM Marketplace

                                                                              CRM Marketplace

                                                                            • MVP Corner

                                                                              MVP Corner





                                                                                Design. Discuss. Deliver.

                                                                                Create visually engaging stories with Zoho Show.

                                                                                Get Started Now


                                                                                  Zoho Show Resources


                                                                                    Zoho Writer Writer

                                                                                    Get Started. Write Away!

                                                                                    Writer is a powerful online word processor, designed for collaborative work.

                                                                                      Zoho CRM コンテンツ






                                                                                        Nederlandse Hulpbronnen


                                                                                            ご検討中の方





                                                                                                  • Recent Topics

                                                                                                  • Something went wrong. One or more fields contain errors

                                                                                                    I am getting this error but there is no way to debug what field is causing the issue . I have over 100 fields. Everything was working fine and then i fixed some fields that should have the same field names but had a typo and i am getting this error. It
                                                                                                  • Integrating Zoho Desk Instances from two separate organizations

                                                                                                    Is it possible to integrate Zoho Desk with an instance from another organization? For example, creating a ticket in one organization can cause the creation of a ticket in the second organization? Or certain tickets from one organization be viewable by
                                                                                                  • Send Whatsapp with API including custom placeholders

                                                                                                    Is is possible to initiate a session on whatsapp IM channel with a template that includes params (placeholders) that are passed on the API call? This is very usefull to send a Utility message for a transactional notification including an order number
                                                                                                  • Knowledge base bug - Error: Article couldn't be updated.

                                                                                                    It took me a while to figure this out, truly one of the most irritating bugs in Zoho. I hope you find this information helpful. When using the knowledge base to create articles, make sure your keywords are in lowercase and separated by commas. Otherwise,
                                                                                                  • Is this possible with Campaigns?

                                                                                                    My company is currently moving CRM's from Monday to Zoho One. Currently, our marketing lead process is send out 7 sms messages over 14 days if the lead is in a certain status. If we don't get a response the lead is put into a "Closed" status. Do we buy
                                                                                                  • How to view two portals (Zoho CRM & Zoho Books) in single login

                                                                                                    Hello there, I need to create a portal access for the Customers. Customer data present in two applications namely Zoho CRM & Zoho Books. My requirement is to show the two different portals(Zoho CRM Portal & Zoho books Portal) in single login. I could
                                                                                                  • Zoho Creator Upcoming Updates - December 2024

                                                                                                    Hi all, We're excited to be back with the latest updates and developments on the Creator platform. Here's what we're going over this month: Deluge AI assistance Rapid error messages in Deluge editor QR code & barcode generator Expandable RTF and multi
                                                                                                  • Invoice status on write-off is "Paid" - how do I change this to "Written off"

                                                                                                    HI guys, I want to write off a couple of outstanding invoices, but when I do this, the status of the invoices shows as "Paid". Clearly this is not the case and I need to be able to see that they are written off in the customer's history. Is there a way
                                                                                                  • Zoho Flow or Schedules

                                                                                                    I have a process where we text our leads 7 times over a 14 day with different content for each text. I created one flow in Zoho Flow to do this, but wondering if there is a more efficient way to accomplish this via Schedules. It goes on for 6 more times
                                                                                                  • Updating Bounced Contacts in Campaigns to the CRM

                                                                                                    The article explains how to update Opt-outs from Campaigns to CRM, but not bounces. While Campaigns will automatically remove any bounced emails from future campaigns, is there a process by which a bounce will update or make a notification in the CRM
                                                                                                  • Bandwidth, voice and poor video

                                                                                                    Dear Team, The webinar has made things quite easy and convenient for educators around the world. We are an art & culture-based organization where students and researchers are our major audience.  While using the Zoho webinar platform, we have observed that the audio lags and the video is of poor quality and often freezes. Some participants don't hear what is being spoken.  We also found that even a slightly slow internet connection disrupts the webinar while it should be working well even on lower
                                                                                                  • No Hope for Zoho Meeting

                                                                                                    Zoho Meeting is just the poorest meeting app I've come across in a long time. The support sucks too. I called to see if there was anything that could be done on the backend and while I was on a test meeting with support the video was lagging and freezing
                                                                                                  • Zoho books and venmo

                                                                                                    Hi, Is there a way to hook Venmo into zoho books? I have a Venmo business account and want to be able to sync that. I know you can do it with the paypal integration but I dont want to use paypal for the fees and that doesnt allow me use/integrate my current
                                                                                                  • Associate Email API Internal Error

                                                                                                    I am trying to associate an already existing email within a function using the Related Emails API. To provide more context, I also have admin permissions and have ensured that the fields are correct and that I have admin permissions when associating the
                                                                                                  • Contacts Don't Always Populate

                                                                                                    I've noticed that some contacts can easily be added to an email when I type their name. Other times, a contact doesn't appear even though I KNOW it is in my contact list. It is possible the ones I loaded from a spreadsheet are not an issue and the ones
                                                                                                  • 550 5.4.6 Unusual sending activity detected. Please try after sometime. <a href=https://www.zoho.com/mail/help/usage-policy.html target=_blank>Learn more.</a>

                                                                                                    Please help me with this. Sending of mails is blocked.
                                                                                                  • Segmenting Contacts Based on Product Purchased

                                                                                                    I am trying to organize our main Marketing Automation email list in a way that segments contacts based on products they have purchased (for example in this case it is 3 different products). To my knowledge, this would require the sync from Zoho CRM to
                                                                                                  • Update a lookup field in CRM from Creator using deluge

                                                                                                    I have a Creator form that creates a new account. When it creates the new account in the Accounts Module, I need it to also populate the Parent Account, which is a lookup field coming from the Module Parent Accounts, field Parent Account Name. I have
                                                                                                  • Urgent Assistance Needed with DKIM Verification

                                                                                                    Hi, I have been trying to verify the DKIM for the past month using your instructions as well as other resources. Unfortunately, I have not been able to resolve the issue, and it remains persistent. I need to address this problem as soon as possible so
                                                                                                  • Someone made ActiveSync and Autodiscover work, with iOS and macOS

                                                                                                    Hi, I'm trying to set this up for the fifth day now and I"m not getting anywhere. Weird thing is that somewhen in the beginning, I had it working, when I still had VirtualServers and certificates mixed up. But now it's all fine, I have the XML file from
                                                                                                  • How do I attach tasks from one task to other tasks in the same project

                                                                                                    How do I attach tasks from one task to other tasks in the same project
                                                                                                  • Not able to change colors help center

                                                                                                    Hi. How can I change the orange color in the help center? You can change everything besides this font color And how can I remove the part on the bottom?
                                                                                                  • Zoho Books Invoice Salesperson: requires ID but there is no "Fetch salesperson" action

                                                                                                    Hi, I am trying to attach a Salesperson to a Zoho Books invoice. In Zoho Flow, the salesperson field required an ID. However, I only have the salesperson name, I need to fetch salesperson by name and then provide the ID. There is no option to fetch salesperson...
                                                                                                  • Change format of quantity format

                                                                                                    Hi,  I would like to change the qunatity format from 1,00 to 1.  Is this possible?   thanks!
                                                                                                  • Ticket Views: filter criteria -> dynamic date values in relation to the current date

                                                                                                    Hello all, It would be very helpful if you could build custom views in such a way that you do not have to adjust the criteria daily or at whatever interval in order to change the fixed date value as needed. For example, I would like to create a view that,
                                                                                                  • Captchas: No support for Google reCAPTCHA or similar

                                                                                                    Hi all, The current captcha integrated into Creator is very basic, and often near-impossible to read. I'm building an app for a charity which includes a couple of public-facing forms, and this is a real issue for people with dyslexia and related conditions - it's effectively excluding them if you want any form of spam protection at all on your published forms (and that being said, the current captcha doesn't even seem very effective - bots can often read it more easily than humans). I've raised this
                                                                                                  • Maintain consistency in ticket responses with shared snippets

                                                                                                    Hello everyone! We are excited to announce that our highly anticipated snippet sharing feature is now available to all users. As you know, snippets are pre-defined message templates, or canned messages, that help agents respond to tickets with efficiency.
                                                                                                  • Tickets - Zoho Desk

                                                                                                    Hi Team, My Clients need to see their tickets created and the status of the ticket in the Zoho Support Desk itself. How can I do this? My Client doesn't have a Zoho Account. They need to access the ticket by the provided link without signing in.
                                                                                                  • Automatically assign Contacts to Account owners

                                                                                                    Hi, I have a finite number of accounts set up in the CRM, and each new contact that comes in is automatically assigned to an Account according to a rule I set up. I want the Contact owner in the Contacts module to be assigned to the relevant Account owner.
                                                                                                  • Making Copies/Duplicates of Zoho Forms (Shared)

                                                                                                    Question to the community: is there a way to take a 'shared form' , make a duplicate copy and save under My Forms, so that i can use that which was already created as a template to make updates to and use as a test form and be able to have full access,
                                                                                                  • Using IMAP configuration for shared email inboxes

                                                                                                    Our customer service team utilizes shared email boxes to allow multiple people to view and handle incoming customer requests. For example, the customer sends an email to info@xxxx.com and multiple people can view it and handle the request. How can I configure
                                                                                                  • Can you help us creating a customised form with payment link?

                                                                                                    I would like to create a customised Transport form where the user will be asked to make payment basis the drop/ pick up they select.
                                                                                                  • Deleting or disabeling predefined ticket list views

                                                                                                    Is it possible to delete or disable predefined views or is this still not possible? For instance, we are not using the chat function and therefore have no use for the "Missed Chats" view. Thanks!
                                                                                                  • How to restore deleted Field

                                                                                                    I edited a field in zoho form and by accident I deleted a field (email address). The form is ongoing to be filled by respondent. Then, when I checked to the all entries and report, the email address is gone. I checked in audit log, there is a record that
                                                                                                  • Unable to load your extension. Please check your plugin-manifest or Resources.json.

                                                                                                    Hi Team, I am using the config module with multiple fields of different types, such as checkboxes and picklists. However, I am encountering the following issues: Error Message: When loading the extension, I get the error: "Unable to load your extension.
                                                                                                  • Remove or hide default views

                                                                                                    I'm looking to only have the views pertinent to my organization.  Is there a way to show only my custom views (or separate them to a different area or something)? If not, this should be a feature as switching from Zendesk we had this option...
                                                                                                  • No Sales Returns on SO's with Dropped Shipped items + Inventory Items

                                                                                                    We have encountered an issue in Zoho related to sales orders that include both dropshipped items and inventory items. Specifically, it is currently not possible to create sales returns for the company’s own inventory items from these sales orders. This
                                                                                                  • Layout Rules / Quick create

                                                                                                    Hello, is there a way to create a layout rule for quick create option? Regards, Katarzyna
                                                                                                  • Issue with Create Note Button and Popup Form in Leads Module

                                                                                                    Hello Zoho Community, I am trying to implement a "Create Note" button in the Leads module with the following functionality: 1. When the button is clicked, a form should pop up with fields to add notes. 2. After filling out the form and clicking Send,
                                                                                                  • Finding draft ticket replies

                                                                                                    Is there a way to see all tickets which have draft replies?
                                                                                                  • Next Page