Extension pointers -JS SDK series#9: A look at multiple JS SDK API methods and their potential uses in different scenarios for widgets

Extension pointers -JS SDK series#9: A look at multiple JS SDK API methods and their potential uses in different scenarios for widgets

Throughout the "Extension Pointers - JS SDK" series, we've demonstrated a wide range of APIs, their usage, and how they can be implemented in a widget, along with working examples. Let's look at a consolidation of all the APIs in this post, to get a quick overview of how APIs can be used in specific scenarios.



All of the scenarios below are based on the assumption that you intend and decide to incorporate widgets into your extension.

Scenario 1

Assume you've developed an extension with a connector for integrating a third-party application. You may now have to perform several operations, such as:
  • Retrieving records or related data from a Zoho CRM module to push into the third-party application
  • Fetching third-party application data in order to either insert or update the data in Zoho CRM modules
To implement these functionalities, you'll need to use the appropriate JS SDK API methods.

Let's take a look at the API methods that can be useful during the above-mentioned scenario:

ZOHO.CRM.API.getRecord
Gets all the details of a record
ZOHO.CRM.API.getRelatedRecords
Retrieves related list records
ZOHO.CRM.API.updateRecord
Updates a record in a module
ZOHO.CRM.CONNECTOR.invokeAPI 
Invokes Connector API
ZOHO.CRM.CONNECTOR.authorize 
Prompts the Connector Authorize window

You can refer to this post to understand in detail about working with connectors in a widget, with the help of a working example.

Scenario 2

Assume you want to invoke a Deluge custom function from your widget. The execute SDK method will be handy in this case:

ZOHO.CRM.FUNCTIONS.execute
Invokes a function and return response

You'll have to construct the parameters required for the function and pass it to the execute method, along with the function's API name. Refer to this post for a complete working example.

Note: Only REST API functions can be invoked from a widget using invokeAPI.

Also, when dealing with a Zoho CRM module's meta data, you can use the ZOHO.CRM.META API method.

Refer to this link to get a detailed working example for getting the metadata of fields in modules.

Scenario 3

As important as it is to add new information to a record, it's equally important to delink the information when changes occur, in order to keep information up to date. Similarly, there are other activities you'll need to perform to implement your business scenarios, like adding notes to the record field to provide additional details on the changes made.

The API methods that will help cover this are:

ZOHO.CRM.API.getRelatedRecords
Retrieves related list records
ZOHO.CRM.API.delinkRelatedRecord 
Delinks the relation between the records
ZOHO.CRM.API.addNotes
Adds notes to a record
We've covered delink-related records with a detailed example in this post. Also, you can check out this post for a combined action that delinks a related record and adds notes.

Scenario 4

Let's say you want to handle data between two applications and make Ajax calls from a widget. There might be multiple HTTP methods that you can use to either retrieve, post, delete, or update data between applications.

In such a case, the API you can use is:

ZOHO.CRM.HTTP.delete
Invokes HTTP delete
ZOHO.CRM.HTTP.get
Invokes HTTP get

And there are many more APIs supported by Zoho CRM JS SDK that helps you perform a variety of functions.

We hope you found this information useful. Keep following this space for more info!


SEE ALSO


    Zoho CRM Plus Resources

      Zoho Books Resources


        Zoho Subscriptions Resources

          Zoho Desk Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources