JS API for Widgets | Zoho Creator Help

JS API for Widgets

1. JS API within Widget

Zoho Creator provides JS API tasks that allow you to perform CRUD operations from within the widgets inserted in an application's page component. They also let you add and manipulate data in other applications in the same Creator account. In other words, these tasks are a wrapper to the Creator REST APIs. The success of the API call to perform a task in an application depends on the permissions provided for the users who access the widget in the target application.
The two JS API versions available are:
V1 - Based on REST API V2
V2 - Based on REST API V2.1 (Recommended)

Example - Say you want to create a uniquely customized form of the feedback matrix review type. This can be achieved by building it as a widget and inserting it in your page. Since this form is situated inside the widget, you will need to perform JS API tasks if you want to manipulate application data.

2. Use Cases

Add and Update Records in the Same Application - Say you've inserted a timer widget in a Project Management application. When an employee starts working on a project, they click the Start button in the widget. This adds a record to the Project Timeline form. When the employee completes the project and clicks the Finish Project button, the same record is updated with the end timeline. This is achieved using the Add Records and Update Records JS API tasks respectively.

3. JS API Configuration

To write the JS API tasks within your widget, you need to perform the following configurations.
STEP 1 : To Be Done in Widget ZIP's HTML File
Include the CDN URL given below by linking it in the script tag of the widget's HTML file. This HTML file will be created automatically when you create a widget ZIP.
  1. <script src="CDN URL"></script>
Notes
Note :
  1. The tasks that can be performed from within the widget are limited to the ones pertaining to a specific version. For example, say you want to execute the JS API V2 Get Records task from within a widget. The records will only be fetched if you've provided the CDN URL pertaining to V2 in the widget's HTML file.

STEP 2 : To be Done in Widget ZIP's JS File
You will have created a JS file inside your widget ZIP to include interactive elements. Use block to write the logic for the JS API tasks in the same file.
Notes
Requirement for JS API V1:
For V1, you should initialize the SDK present in the CDN URL before writing logic for the JS API tasks. Use the below method in the widget ZIP's JS file:
  1. ZOHO.CREATOR.init()
  2.         .then(function(data) {
  3.           //Code goes here
  4.         });

4. JS API Tasks

The JS API V2 tasks you can perform from within the widgets are:
1. Data APIs
  1. Get Record by ID
  2. Get Records
  3. Get Record Count
  4. Update Record by ID
  5. Update Records
  6. Delete Record by ID
  7. Delete Records
 2. Publish APIs
  1. Add Records
  2. Get Record by ID
  3. Get Records 
 3. File APIs
  1. Upload File
  2. Read File
4. Meta APIs
  1. Get Fields
  2. Get Forms
  3. Get Reports
  4. Get Pages
  5. Get Sections
  6. Get Applications
  7. Get Applications by Workspace
5. Util APIs
  1. Set Image Data
  2. Navigate Parent URL
  3. Get Init Params
  4. Get Query Params
  5. Get Widget Params
Info
Only few of these tasks are supported in V1. Refer to JS API V1 Overview to learn more about the tasks that can be performed in V1.

5. Points to Note

Version-Wise Limitations
  1. The tasks that can be performed from within the widget are limited to the ones pertaining to a version. For example, say you want to execute the JS API v2 Get Records task from within a widget. The records will be fetched only if you've provided the CDN URL pertaining to v2 in the widget's HTML file.
  2. If you need to change the current JS API version, the following changes have to be done:
    1. Change the CDN URL in the widget ZIP's HTML file to the required version
    2. SDK initialization is required only for JS API v1. Add or remove the initialization method based on the required version, in the widget ZIP's JS file.
    3. Update the syntax and configuration parameters of the JS API tasks to match those of the required version, in the widget ZIP's JS file.
The widget file needs to be re-uploaded afterwards. Keep in mind that after the CDN URL is updated, any tasks from the version used before will stop working.
General
  1. Any changes to the JS script present in a widget's file will require re-uploading the modified file for the widget to work as required.
  2. Make sure to provide the mandatory parameters necessary for a task in the configuration for successful execution.
  3. Only Publish API tasks will work in published pages that can be accessed by people who do not hold a Creator account.

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION





                              Quick Links Workflow Automation Data Collection
                              Web Forms Enterprise Begin Data Collection
                              Interactive Forms Workplace Data Collection App
                              CRM Forms Customer Service Accessible Forms
                              Digital Forms Marketing Forms for Small Business
                              HTML Forms Education Forms for Enterprise
                              Contact Forms E-commerce Forms for any business
                              Lead Generation Forms Healthcare Forms for Startups
                              Wordpress Forms Customer onboarding Order Forms for Small Business
                              No Code Forms Construction RSVP tool for holidays
                              Free Forms Travel
                              Prefill Forms Non-Profit

                              Intake Forms Legal
                              Mobile App
                              Form Designer HR
                              Mobile Forms
                              Card Forms Food Offline Forms
                              Assign Forms Photography
                              Mobile Forms Features
                              Translate Forms Real Estate Kiosk in Mobile Forms
                              Electronic Forms Banking 
                              Notification Emails for Forms Alternatives Security & Compliance
                              Holiday Forms Google Forms alternative  GDPR
                              Form to PDF Jotform alternative HIPAA Forms
                              Email Forms
                              Encrypted Forms
                              Embeddable Forms
                              Secure Forms
                              Drag & drop form builder
                              WCAG

                                      Create. Review. Publish.

                                      Write, edit, collaborate on, and publish documents to different content management platforms.

                                      Get Started Now




                                                        You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                            Manage your brands on social media


                                                              • Desk Community Learning Series


                                                              • Digest


                                                              • Functions


                                                              • Meetups


                                                              • Kbase


                                                              • Resources


                                                              • Glossary


                                                              • Desk Marketplace


                                                              • MVP Corner


                                                              • Word of the Day


                                                              • Ask the Experts


                                                                Zoho Sheet Resources

                                                                 

                                                                    Zoho Forms Resources


                                                                      Secure your business
                                                                      communication with Zoho Mail


                                                                      Mail on the move with
                                                                      Zoho Mail mobile application

                                                                        Stay on top of your schedule
                                                                        at all times


                                                                        Carry your calendar with you
                                                                        Anytime, anywhere




                                                                              Zoho Sign Resources

                                                                                Sign, Paperless!

                                                                                Sign and send business documents on the go!

                                                                                Get Started Now




                                                                                        Zoho TeamInbox Resources





                                                                                                  Zoho DataPrep Demo

                                                                                                  Get a personalized demo or POC

                                                                                                  REGISTER NOW


                                                                                                    Design. Discuss. Deliver.

                                                                                                    Create visually engaging stories with Zoho Show.

                                                                                                    Get Started Now









                                                                                                                        • Related Articles

                                                                                                                        • Use widgets to create an online mobile store

                                                                                                                          Requirement Display a card layout with each card containing mobile details like an image, company, model, and features. Any third party languages can also be used, provided the required dependencies like packages, CDN URLs etc. are included. Users ...
                                                                                                                        • Understand widgets

                                                                                                                          This help page is for users in Creator 6. If you are in the older version (Creator 5), click here. Know your Creator version. Widgets are used to extend the capabilities of your Zoho Creator application so that you could perform tasks that could not ...
                                                                                                                        • Zoho Creator - Widgets Kit

                                                                                                                          Overview 1. What is this kit for? This kit is designed to help you create widgets in Zoho Creator using your existing Figma design. It contains step-by-step instructions and supported components for Creator widgets. If you're using this kit for the ...
                                                                                                                        • Use Widgets to Track Live Location

                                                                                                                          Requirement Share the live location of a device and display it on a map that can be accessed from anywhere for tracking purposes. Use Case When an ambulance is on the run, it needs to reach the nearest hospital on time. To avoid any traffic, the ...
                                                                                                                        • Understanding AI Skill

                                                                                                                          This feature can be enabled on request. To get early access, you can write to us at support@zohocreator.com. 1. In a nutshell AI Skill lets you automate tasks using simple instructions. You can create a skill by describing how the AI should behave ...
                                                                                                                          Wherever you are is as good as
                                                                                                                          your workplace

                                                                                                                            Resources

                                                                                                                            Videos

                                                                                                                            Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                            eBooks

                                                                                                                            Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                            Webinars

                                                                                                                            Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                            CRM Tips

                                                                                                                            Make the most of Zoho CRM with these useful tips.



                                                                                                                              Zoho Show Resources