JS API documentation | Zoho Creator Help

JS API documentation

This help page is for users in Creator 6. If you are in the older version (Creator 5), click here . Know your Creator version .
Download the latest JS SDK library from the CDN URL given below and link it using the script tag.
Initialize the SDK using the below method and use then block to write the logic
  1. ZOHO.CREATOR.init()
  2.         .then(function(data) {
  3.           //Code goes here
  4.         });
To get the value from the parameters configured in pages, use the below method
  1. var queryParams = ZOHO.CREATOR.UTIL.getQueryParams();
To get the login user's email address, use the below method
  1. var initparams = ZOHO.CREATOR.UTIL.getInitParams();
Sample response:
  1. {
  2.     "scope": "zylkercorp",
  3.     "envUrlFragment": "/environment/development",
  4.     "appLinkName": "widgetapp",
  5.     "loginUser": " john@zylker.com "
  6. }
The values of the image field will be an API endpoint in case the image is uploaded from computer or phone, use the below method to convert the endpoint to image data and assign the value to the source of the image tag. In another case, the image can be a public image link, and this method works for both cases.
  1. var imageTag = document.getElementById("imgtag");
  2. var imageURL = "/api/v2/zylker/Contacts/view/All_Contacts/66359000000015039/Upload/download";
  3. ZOHO.CREATOR.UTIL.setImageData(imageTag, imageURL, callbackFunction);
Widget API allows customers to  push  and  pull  data from other apps in their Creator account. The success of the API call to push or pull data in other apps depends on the permissions provided for users of that app.

Record APIs

These APIs help you perform different tasks with the records of the application. The various Record APIs are as follows:

Note appName  needs to be passed only when you need to push or pull data from other apps in your account.

Add Record

Method :  addRecord
Name Description
formName Link name of the form to which the records to be added. Refer this page to view and change the link name.
data Form data in json format, where the format for all the fields has been specified here.
appName Link name of the application from which data needs to be pushed to.
Syntax :
  1. //configuration json
  2. config = {
  3.                    appName : "${APPNAME}",
  4.                    formName : "${FORMNAME}",
  5.                    data : "${FORMDATA}"
  6. }
  7. //add record API
  8. ZOHO.CREATOR.API.addRecord(config).then(function(response){
  9. //callback block
  10. });
Example :

  1. //configuration json
  2. var config = {
  3.              appName : "zylker",
  4.              formName : "timesheet",
  5.              data : formData
  6. }
  7. //add record API
  8. ZOHO.CREATOR.API.addRecord(config).then(function(response){
  9.        if(response.code == 3000){
  10.        console.log("Record added successfully");
  11. }
  12. });
Form data :
  1. formData = {
  2.     "data" : {
  3.         "Name": {
  4.             "first_name": "James",
  5.             "last_name": "Kyle",
  6.         },
  7.         "Address": {
  8.             "address_line_1": "Dari Mart",
  9.             "address_line_2": "Hayden Bridge Rd",
  10.             "district_city" : "Springfield",
  11.             "state_province" : "Oregon",
  12.             "postal_code" : "97477",
  13.             "country" : "United States"
  14.         },
  15.         "Rich_Text" : "The phone number is <b>+1541-726-4051</b>",
  16.         "Phone_Number": "+15417264051",
  17.         "Single_Line": "A simple one line text",
  18.         "Email": " james@zylker.com ",
  19.         "Dropdown" : "Open",
  20.         "Radio" : "Closed",
  21.         "Multi_Select" : ["New", "Used"],
  22.         "Checkbox" : ["Refurbished", "Used"],
  23.         "Number": "1000",
  24.         "Decimal" : "1000.00",
  25.         "Percent": "60.00",
  26.         "Date_field" : "10-Jan-2020",
  27.         "Date_Time" : "23-Mar-2020 12:25:43 PM",
  28.         "Image" : " https://www.zylker.com/sites/default/profile-01.jpg",
  29.         "Ur1": {
  30.             "value": "Dari Mart",
  31.             "url": " www.darimart.com",
  32.             "title": "Dari mart provisional store"
  33.         },
  34.         "Lookup_Single_Select" : "521270000078464",
  35.         "Lookup_Multi_Select" : ["5212750000247932","5212750000564867"],
  36.         "SubForm" : [
  37.             {
  38.                 "Single_Line" : "Service Equipment",
  39.                 "Dropdown" : "New Order"
  40.             },
  41.             {
  42.                 "Single_Line" : "Rotary Machine",
  43.                 "Dropdown" : "Replacement",
  44.             }
  45.         ]
  46.     }
  47. }
Response :
  1. response = {
  2.     "code": 3000,
  3.     "data": {        
  4.         "ID": "2000000245119"
  5.     },
  6.     "message": "success"

Update Record

Method :  updateRecord
Name Description
reportName Link name of the report through which the record to be updated. Refer here to get and update the link name of a report 
id ID value of the record to be updated
data Form data in json format, where format for all the fields have been specified here
appName Link name of the application in which data needs to be updated.
Syntax :
  1. //configuration json
  2. config = {
  3.         appName : "${APPNAME}",
  4.     reportName : "${REPORTNAME}",
  5.     id: "${RECORDID}",
  6.     data : "${FORMDATA}"
  7. }

  8. //update record API
  9. ZOHO.CREATOR.API.updateRecord(config).then(function(response){
  10.  //callback block
  11. });
Example :
  1. var config = { 
  2.        appName : "zylker"
  3.        reportname : "All-Timesheet", 
  4.        id : "2000000245119"
  5.        data : formData 

  6. ZOHO.CREATOR.API.updateRecord(config).then(function(response){
  7.     if(response.code == 3000){
  8.         console.log("Record updated successfully");
  9.     } 
  10. });
Response :
  1. response = {
  2.  "code": 3000,
  3.  "data": {  
  4.   "ID": "2000000245119"
  5.     },
  6.  "message": "success"
  7. }


Get All Records

Method :  getAllRecords
Configuration :
Name Description
reportName Link name of the report through which the record to be updated. Refer here to get and update the link name of a report 
criteria (optional) Condition to filter the record, which is applied along with the condition specified in the report filter. The criteria must be specified in the following format  is the link name of the field, which compares with the  and the comparison is based on the . The supported operators are !=, <=, >=,<, >, == You can combine more than one criteria using logical AND (&&) and logical OR(||) Example : (Stage == "Open" && Score > 40)
page (optional) Index or number of the page to be retrieved. The default page number is 1
pageSize (optional) Total number of records to be retrieved in the specified page. The default size is 100 and the maximum size is 200
appName Link name of the application from which data needs to be pulled from.
Note :
  • The response will return the data that’s displayed in both the Quick view and Detail view of the corresponding report
  • When the Detail view sports a related block of data, which is related via a lookup field, this API’s response will also include the data from that lookup field's display fields.
Syntax :
  1. //configuration json
  2. config = {
  3.         appName : "${APPNAME}",
  4.     reportName : "${REPORTNAME}",
  5.     criteria: "${CRITERIA}",
  6.     page : "${PAGENUMBER}",
  7.     pageSize : "${PAGESIZE}"
  8. }

  9. //get all records API
  10. ZOHO.CREATOR.API.getAllRecords(config).then(function(response){
  11.     //callback block
  12. });
Example :
  1. var config = { 
  2.     appName : "zylker"
  3.     reportName : "All-Timesheet", 
  4.     criteria : "(Status == \"Open\" && Priority = \"High\")",
  5.     page : 1,
  6.     pageSize : 10
  7. }

  8. ZOHO.CREATOR.API.getAllRecords(config).then(function(response){
  9.     var recordArr = response.data;
  10.     for(var index in recordArr){
  11.         console.log(recordArr[index]);
  12.     }   
  13. });
Response :
  1. response = {
  2.   "code": 3000,
  3.   "data": [
  4.     {
  5.       "ID": "52129000000146011",
  6.       "Name": {
  7.         "first_name": "James",
  8.         "last_name": "Kyle",
  9.         "display_value": "James Kyle"
  10.       },
  11.       "Address": {
  12.         "address_line_1": "Dari Mart",
  13.         "address_line_2": "995 Hayden Bridge Rd",
  14.         "district_city": "Springfield",
  15.         "state_province": "Oregon",
  16.         "postal_code": "97477",
  17.         "country": "United States",
  18.         "latitude": "33.9307727",
  19.         "longitude": "-116.8767541",
  20.         "display_value": "Dari Mart, 995 Hayden Bridge Rd, Springfield, Oregon, United States"
  21.       },
  22.       "Rich_Text": "The phone number is <b>+1541-726-4051</b>",
  23.       "Phone_Number": "+15417264051",
  24.       "Single_Line": "A simple one line text",
  25.       "Email": " james@zylker.com ",
  26.       "Number": "23",
  27.       "Decimal": "1000.00",
  28.       "Percent": "60.00",
  29.       "Date_field": "10-Jan-2020",
  30.       "Date_Time": "23-Mar-2020 12:25:43 PM",
  31.       "Dropdown": "Open",
  32.       "Radio": "Closed",
  33.       "Multi_Select": [
  34.         "New",
  35.         "Used"
  36.       ],
  37.       "Checkbox": [
  38.         "Refurbished",
  39.         "Used"
  40.       ],
  41.       "Image": " https://www.zylker.com/sites/default/profile-01.jpg",
  42.       "File_Upload": "/api/v2/zylker/Contacts/view/Contacts/635900380/Upload/download",
  43.       "Ur1": {
  44.         "value": "Dari Mart",
  45.         "url": " www.darimart.com",
  46.         "title": "Dari mart provisional store"
  47.       },
  48.       "Lookup_Single_Select": {
  49.         "display_value": "James - 4269",
  50.         "ID": "521270000078464"
  51.       },
  52.       "Lookup_Multi_Select": [
  53.         {
  54.           "display_value": "Door Step Delivery",
  55.           "ID": "5212750000247932"
  56.         },
  57.         {
  58.           "display_value": "Cash on Delivery",
  59.           "ID": "5212750000564867"
  60.         }
  61.       ],
  62.       "Subform": [
  63.         {
  64.           "display_value": "Service Equipment,New Order",
  65.           "ID": "5212750000433263"
  66.         },
  67.         {
  68.           "display_value": "Rotary Machine,Replacement",
  69.           "ID": "5212750000090778"
  70.         }
  71.       ]
  72.     },
  73.     {
  74.       //Record 2
  75.     },
  76.     {
  77.     //Record 3
  78.     }
  79.   ]
  80. }


Get Specific Record Using ID

Method :  getRecordById
Configuration :
Name Description
reportName Link name of the report through which the record to be updated. Refer here to get and update the link name of a report 
id ID value of the record to be retrieved
appName Link name of the application from which data needs to be pulled from.
 
Note:
  • The response will return the data that’s displayed in both the Quick view and Detail view of the corresponding report
  • When the Detail view sports a related block of data, which is related via a lookup field, this API’s response will also include the data from that lookup field's  display fields.
Syntax :
  1. //configuration json
  2. config = {
  3.         appName : "${APPNAME}",
  4.     reportName : "${REPORTNAME}",
  5.     id: "${RECORDID}"
  6. }

  7. //get specific record API
  8. ZOHO.CREATOR.API.getRecordById(config).then(function(response){
  9.     //callback block
  10. });

Example :
  1. var config = {
  2.        appName : "zylker"
  3.        reportName : "All-Timesheet", 
  4.        id : "2000000193171"

  5. ZOHO.CREATOR.API.getRecordById(config).then(function(response){
  6.     console.log(response.data);
  7. });

Response :
  1. response  = {
  2.  "code": 3000,
  3.  "data": {
  4.         "ID": "52129000000146011",
  5.   "Name": {
  6.             "first_name": "James",
  7.             "last_name": "Kyle",
  8.    "display_value": "James Kyle"
  9.           },
  10.   "Address": {   
  11.    "address_line_1": "Dari Mart",
  12.                "address_line_2": "995 Hayden Bridge Rd",
  13.                "district_city" : "Springfield",
  14.                "state_province" : "Oregon",
  15.                "postal_code" : "97477",
  16.                "country" : "United States"
  17.    "latitude": "33.9307727",
  18.    "longitude": "-116.8767541",
  19.    "display_value": "Dari Mart, 995 Hayden Bridge Rd, Springfield, Oregon, United States"
  20.   },
  21.   "Rich_Text" : "The phone number is <b>+1541-726-4051</b>",
  22.           "Phone_Number": "+15417264051",
  23.           "Single_Line": "A simple one line text",
  24.           "Email": " james@zylker.com ",
  25.   "Number": "23",
  26.           "Decimal" : "1000.00",
  27.   "Percent": "60.00",
  28.           "Date_field" : "10-Jan-2020",
  29.           "Date_Time" : "23-Mar-2020 12:25:43 PM",
  30.   "Dropdown" : "Open",
  31.           "Radio" : "Closed",
  32.           "Multi_Select" : ["New", "Used"],
  33.           "Checkbox" : ["Refurbished", "Used"],
  34.         "Image" : " https://www.zylker.com/sites/default/profile-01.jpg",
  35.         "File_Upload" : "/api/v2/zylker/Contacts/view/Contacts/635900380/Upload/download",
  36.   "Ur1": {
  37.                "value": "Dari Mart",
  38.                "url": " www.darimart.com",
  39.                "title": "Dari mart provisional store"
  40.           },
  41.   "Lookup_Single_Select" : {
  42.             "display_value" : "James - 4269",
  43.    "ID" : "521270000078464"
  44.    
  45.   },
  46.   "Lookup_Multi_Select" : [{
  47.    "display_value" : "Door Step Delivery",
  48.             "ID" : "5212750000247932"
  49.   },
  50.   {
  51.    "display_value" : "Cash on Delivery",
  52.             "ID" : "5212750000564867"   
  53.   }],
  54.      "Subform" : [{    
  55.    "display_value" : "Service Equipment,New Order",
  56.             "ID" : "5212750000433263"
  57.   },
  58.   {   
  59.                "display_value" : "Rotary Machine,Replacement",
  60.             "ID" : "5212750000090778"
  61.   }]  
  62.  }
  63. }

Get Record Count

Method :   getRecordCount
Configuration :
Name Description
reportName Link name of the report for which the record count is required. Refer here to get and update the link name of a report 
appName Link name of the application from which data needs to be pulled from and counted.
criteria (optional) Condition to filter the record, which is applied along with the condition specified in the report filter. The criteria must be specified in the following format  is the link name of the field, which compares with the  and the comparison is based on the . The supported operators are !=, <=, >=,<, >, == You can combine more than one criteria using logical AND (&&) and logical OR(||) Example : (Stage == \"Open\" && Score > 40)
Syntax :
  1. //configuration json
  2. config = {
  3.     appName: "first-application",
  4.     reportName: "Form_Report",
  5.     criteria: "(Single_Line = \"High\")" //optional
  6. }

  7. ZOHO.CREATOR.API.getRecordCount(config).then(function (response) {
  8.     //your code goes here.
  9. });

Example:
  1. var config = {
  2.           appName : "zylker"
  3.           reportName : "All-Timesheet",
  4. }

  5. ZOHO.CREATOR.API.getRecordCount(config).then(function (response){
  6.             console.log(response);
  7. });
Response:                
  1. response  =
  2. {
  3.      "result": {
  4.             "records_count": "4"
  5.       },
  6.       "code": 3000
  7. }


Delete Record

Method :  deleteRecord
Configuration :
Name Description
reportName Link name of the report through which the record to be updated. Refer here to get and update the link name of a report 
criteria Condition to filter the record, which is applied along with the condition specified in the report filter. The criteria must be specified in the following format
<Field Name> <Operator> <Value>

<Field name> is the link name of the field, which compares with the<Value> and the comparison is based on the <Operator>. The supported operators are !=, <=, >=,<, >, ==

You can combine more than one criteria using logical AND (&&) and logical OR(||)
Example : (Stage == "Open" && Score > 40)
appName Link name of the application from which data needs to be deleted.
 
Note:  The maximum of 200 records can be deleted for every API call and you will receive error when the number of records exceeds 200.
Syntax :
  1. //configuration json
  2. config = {
  3.         appName : "${APPNAME}",
  4.     reportName : "${REPORTNAME}",
  5.     criteria: "${CRITERIA}"
  6. }

  7. //delete record API
  8. ZOHO.CREATOR.API.deleteRecord(config).then(function(response){
  9.     //callback block
  10. });
Example :
  1. var config = { 
  2.        appName : "zylker"
  3.        reportName : "All-Timesheet", 
  4.        criteria : "(Status == \"Invalid\" && Date '01-01-2019')"

  5. ZOHO.CREATOR.API.deleteRecord(config).then(function(response){
  6.     console.log("Record has been deleted");
  7. });
Response :
  1. response = {
  2.     "result": [{
  3.         "code": 3000,
  4.         "data": {
  5.             "ID": "66359000000021016"
  6.           },
  7.         "message": "success"
  8.        },
  9.        {
  10.        "code": 3000,
  11.        "data": {
  12.            "ID": "66359000000024309"
  13.          },
  14.        "message": "success"
  15.       }
  16.     ],
  17.     "code": 3000
  18. }


Upload File

Method :  uploadFile
Configuration :
Name Description
reportName Link name of the report through which the record to be updated. Refer here to get and update the link name of a report 
id ID value of the record where the file to be uploaded
fieldName

Link name of the field to which the file has to be uploaded.  Refer here to get the link name of the field. The allowed field types are  Image, SignatureFile UploadAudio, and Video. 

In case the file has to be uploaded to a field which has been added inside a subform, the fieldName will be subform field link name followed by the field link name of the field to be uploaded with (dot) in between. Example: ${SUBFORMFIELDNAME.FIELDNAME}

fiel It is a javascript File object to be uploaded. Refer here to know more about javascript File API
parentId In case the file has to be uploaded to a field which has been added inside a subform, then the parentId is the ID value of the parent record, i.e the main form record in which the subform has been embedded.
appName Link name of the application in which data needs to be uploaded.

  Note:   The file can be uploaded only after submitting a record and this API will upload one file to one field at a time. In case of more number of fields in a form, this API need to call for each field separately.

Syntax :   

  1. //configuration json
  2. config = {
  3.         appName : "${APPNAME}",
  4.     reportName : "${REPORTNAME}",
  5.     id: "${RECORDID}",
  6.         fieldName : "${SUBFORMFIELDNAME.FIELDNAME}",
  7.     parentId : "${RECORDID}",
  8.         file : "${FILEOBJECT}"
  9. }

  10. //upload file API
  11. ZOHO.CREATOR.API.uploadFile(config).then(function(response){
  12.  //callback block
  13. });
Example:
  1. var fileObject = document.getElementById("fileInput").files[0];

  2. var config = { 
  3.         appName : "zylker"
  4.     reportName : "All-Timesheet", 
  5.     id : "2000000193171",
  6.     fieldName : "Attachments",
  7.     file : fileObject

  8. ZOHO.CREATOR.API.uploadFile(config).then(function(response){
  9.  console.log("File uploaded successfully");
  10. });
Response :
  1. response = {
  2.   "code": "3000",
  3.   "data": {
  4.     "filename": "Rental Agreement-March.pdf",
  5.     "filepath": "1587402896598_Rental_Agreement-March.pdf",
  6.     "message": "success"
  7.   }
  8. }
  1. Understand widgets
  1. Install CLI
  1. Create your first widget
  1. Add widgets to page
  1. Sample widget




    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








                                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

                                      Zoho Desk Resources

                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day


                                        Zoho Marketing Automation

                                          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 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







                                                                                            You are currently viewing the help articles of Sprints 1.0. If you are a user of 2.0, please refer here.

                                                                                            You are currently viewing the help articles of Sprints 2.0. If you are a user of 1.0, please refer here.



                                                                                                  • Related Articles

                                                                                                  • Generate Barcode using third-party API

                                                                                                    Requirement   Generate a barcode based on the provided IMEI (International Mobile Equipment Identity) number using a third-party API. Use Case   A mobile store uses an order management application to manage their orders. The application has a form ...
                                                                                                  • Create and manage node.js functions

                                                                                                    A function is a set of statements that is invoked in an application to perform a certain action or yield a desired result based on the logic in the code. Node.js is a cross-platform, open-source JavaScript runtime environment. Introducing Node.js ...
                                                                                                  • API Access Control

                                                                                                    Zoho Creator's Rest API allows you to interface with your Zoho Creator applications to fetch, add, update, and delete data. The API access control page lets you restrict the applications that can be accessed using these APIs. To Enable or Disable API ...
                                                                                                  • 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 ...
                                                                                                  • Add widget to a page

                                                                                                    This help page is for users in Creator 6. If you are in the older version (Creator 5), click here. Know your Creator version. To add a widget to a page: Access the application to view and use the widget that you configured. Navigate to the Design ...
                                                                                                    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