Hello, everyone! Welcome to another Kaizen week. In this post, we will discuss how third-party applications can integrate with Zoho CRM using
Java SDK 5.0.
Use case
Zylker is a real-estate app which can integrate with any CRM vendor and uses that data for it's use-cases. Zylker uses Java for the backend server code. Now they want to integrate with Zoho CRM. How will they do it? Those users could be in different Zoho data centers like Europe (.eu), USA(.com), India(.in), Australia(.com.au) etc. With Zoho CRM's Java SDK 5.0, which consumes Zoho CRM v5 APIs, we can to do authorization and establish this integration. Zylker will write one common code and it should be usable for any CRM orgs across all DCs.
Java SDK Project dependency
Include the Java dependency using either Maven or Gradle. The maven dependency is as below:
<repositories>
<repository> <id>zohocrmsdk-5-0</id> </repository> </repositories> <dependencies> <dependency> <groupId>com.zoho.crm</groupId> <artifactId>zohocrmsdk-5-0</artifactId> <version>4.0.0</version> </dependency> </dependencies>
|
If you are not using Maven or Gradle, please include the Zoho CRM
Java SDK JAR and
dependant JARs directly into the Java build path.
Setting up the OAuth client
Create a
Server-based Application in the corresponding API console page (
https://www.zohoapis.{com/in/eu/com.au}). Enable "
Multi-DC" under Settings of the app. Choose "
Use the same OAuth credentials for all data centers". With this, you can use the same client ID, client secret, and redirect URI to authorize any Zoho account in any data center. Please refer to our previous posts to know more about domains and environments [
Part -1] and [
Part - 2].
Integrating the client with your application
In Zylker's web UI, there will be an option to integrate with Zoho CRM. The integration can be initiated from a link or a button containing the
authorization URL, along with the corresponding client ID, state, redirect URI, and OAuth scopes. Once the user clicks on this link/button and completes the OAuth authorization process on Zoho, they will be redirected to the specified redirect URI with HTTP parameters
location,
code,
accounts server, and
state. These parameters can be utilized within the Java code logic of the redirect URI to begin using the Zoho CRM Java SDK.
The codes used in this post are hosted
here for reference. We will focus on two distinct steps as mentioned below, for Zylker integration with Zoho CRM using Java SDK.
1. Authorize with Zoho CRM
2. Fetching data from Zoho CRM
1. Authorize with Zoho CRM
The aim of this step is to connect with the user's Zoho CRM and store the token details such as refresh token, access token and expiry time in the preferred datastore like MySQL, pgSQL etc. Once the user lands on the redirect URI after the OAuth2.0 authorization, we can extract the email of the logged-in user from zylker.com cookies. We also obtain the grant token and location from the redirect_uri of the authorization request. We pass these three values to the below integrateZohoCRM() function. This function takes care of creating a token for the connected Zoho CRM account and persisting it in the preferred datastore.
public static Boolean integrateZohoCRM(String location, String grant_token, String user_email)
{ Boolean integrationStatus = Boolean.FALSE; try { Environment environment = DataCenter.get(location); OAuthToken userToken = new OAuthToken.Builder() .clientID(OAuthClientDetails.CLIENT_ID) .clientSecret(OAuthClientDetails.CLIENT_SECRET) .grantToken(grant_token) .redirectURL(OAuthClientDetails.REDIRECT_URL) .userSignature(new UserSignature(user_email)) //email of the user who is trying to integrate with Zoho CRM
.build();
new Initializer.Builder().environment(environment).token(userToken).initialize(); integrationStatus = Boolean.TRUE; } catch (SDKException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return integrationStatus; }
|
Refer
here for the exact code section.
OAuthToken.Builder() creates a new instance of the builder for the OAuthToken class. It allows you to conveniently set up the necessary details for creating an OAuth token for authentication purposes. On passing the client ID, client secret, grant token, redirect URL, and user signature to the OAuthToken.Builder() method, we get the userToken object. One more important thing to note is that we have set the user signature as .userSignature(new UserSignature(user_email)) . This means that we are referring to the token uniquely by the email id of the logged-in Zylker user. The same signature should be used for any further operation to be done in Zoho CRM on behalf of this user.
Now that we have the OAuthToken object, we can send it to the Initializer class (as shown below) to create the refresh/access tokens and persist it.
new Initializer.Builder().environment(environment).token(userToken).initialize();
|
As we haven't mentioned anything about where to do the persistence, by default the token details are persisted in a file named 'sdk_tokens.txt' using
File Persistence. The content of the file would look like the following:
"id","user_name","client_id","client_secret","refresh_token","access_token","grant_token","expiry_time","redirect_url","api_domain" //Do not clear this default format, or else you will need to generate a grant token again in order to run the program. "1","patricia@gmail.com","1000.xxxxx","xxxxxx","1000.xxxxxx.xxxx","1000.xxxxxxxxx.xxxxxxx","1000.xxxxxxxxx.xxxxxxx","1697370902510","https://www.zoho.com","https://www.zohoapis.com"
|
Apart from File Persistence, tokens can be persisted using
Database persistence or
Custom persistence.
Note
When Zoho introduces a new DC in future, it will be enough to update the project with the latest version of Zoho CRM Java SDK 5.0 and no further code change will be required.
2. Fetching data from ZohoCRM
Once the integration is done, we can create OAuthToken with the user's email as UserSignature and call Zoho CRM Java SDK function. This will fetch the data specific to the user. The following fetchCRMData() function is a sample to fetch data from Zoho CRM.
public static void fetchCRMData(String email) throws Exception {
OAuthToken userToken1 = new OAuthToken.Builder() .userSignature(new UserSignature(email)) .build(); new Initializer.Builder().token(userToken1).initialize(); RecordOperations ro = new RecordOperations(); ParameterMap paramInstance = new ParameterMap(); List < String > fieldNames = new ArrayList < > (Arrays.asList("Company", "Email"));
paramInstance.add(RecordOperations.GetRecordsParam.FIELDS, String.join(",", fieldNames));
@SuppressWarnings("rawtypes")
APIResponse response = ro.getRecords("Leads", paramInstance, null);
.
.
.
} |
Refer here for the exact code section.
In this example, we use the SDK's RecordOperations() for retrieving records from the Leads module. This is done in the following steps:
- A new instance of RecordOperations is being created and assigned to the variable ro. This object handles operations related to records in Zoho CRM.
- ParameterMap instance is used to specify request parameters for the API calls. We can fetch the Company and the Email fields from the Leads module by passing them as the FIELDS parameter.
- We use the getRecords() method to make the API request via SDK, which fetches the respective CRM data.
We hope you found this post useful and interesting. Stay tuned for more exciting posts.
For more topics on Kaizen, please refer to our
Kaizen collection here.
Recent Topics
How to upload own video?
How can you upload your own video on your zoho website? I do not want to use another host, but i want to insert my own files. how can i do this?
Searching customer field
Hello, When entering a receipt, we select customer information. The customer information is synced with Zoho CRM. However, we can't find the customer information because it searches for words that begin with the entered value. It needs to search for words
Introducing Version-3 APIs - Explore New APIs & Enhancements
Happy to announce the release of Version 3 (V3) APIs with an easy to use interface, new APIs, and more examples to help you understand and access the APIs better. V3 APIs can be accessed through our new link, where you can explore our complete documentation,
Rotate an Image in Workdrive Image Editor
I don't know if I'm just missing something, but my team needs a way to rotate images in Workdrive and save them at that new orientation. For example one of our ground crew members will take photos of job sites vertically (9:16) on his phone and upload
Improved RingCentral Integration
We’d like to request an enhancement to the current RingCentral integration with Zoho. RingCentral now automatically generates call transcripts and AI-based call summaries (AI Notes) for each call, which are extremely helpful for support and sales teams.
Resume Harvester: New Enhancements for Faster Sourcing
We’re excited to share a set of enhancements to Resume Harvester that make sourcing faster and more flexible. These updates help you cut down on repetitive steps, manage auto searches more efficiently, and review candidate profiles with ease. Why we built
Using Zoho Flow to create sales orders from won deal in Zoho CRM
Hi there, We are using Zoho Flow to create sales orders automatically when a deal is won in Zoho CRM. However, the sales order requires "Product Details" to be passed in "jsonobject", and is resulting in this error: Zoho CRM says "Invalid input for invalid
WIDGET in related record list ZOHO CRM; how to get and put data to subform custom fields?
he need: Read and write two custom subform line-item fields on Quotes: Segment_wyceny (picklist/text) and W_pakiecie (number). Write works; read does not return these fields via SDK. Environment Zoho CRM Widget Zoho Embedded App SDK v1.2 Module: Quotes
Cliq iOS can't see shared screen
Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
Zoho CRM Tracking Google Enhanced Conversions
Can anyone @Zoho, consultants, or users help me understand if Zoho CRM is going to support Google's Enhanced Conversions? I included some information from Google below about it. We use Google Adwords for our pay per click advertising for lead generation,
zoho click, and nord VPN
Unfortunately, we've been having problems with Zoho Click, where essentially the line cuts off after about a minute's worth of conversation every time we are on VPN. Is there a way we can change this within the settings so it does not cut the line off
Recurring Supervisor Rule Reminders for Open/In-Progress Tickets
Hello Zoho Support Team, I would like to suggest a potential improvement regarding reminders for tickets and activities in Zoho Desk. Currently, it is possible to set reminders only once. In the Supervisor Rules section, it is possible to configure reminders
Connecting Portals from different Zoho apps
Hi, I note that Zoho has functionality for customer portals for several of the Zoho apps, like CRM, Projects, Desk etc. Is there any way to connect these portals? It would be great if we could give our customers access to a portal in which they could
Billing Management: #5 Usage Billing
After understanding the nuances of Advance Billing and Retainers, we will explore one of the booming billing models. Long ago, villagers drew water from a shared well in a small village. The well was a lifeline for the entire community. Ravi, the well
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
Inventory Adjustments
Hi, How to transfer the material from one head to another ? Like materials purchased for manufacturing the laptop need to transfer from consumption inventory (Quantity of raw materials reduced) to destination inventory ( Quantity of Laptop increased)
Zoho CRM Community Digest - Aug 2025 | Part 1
Hey everyone! The first half of August went by, and we have a few announcements and some good noteworthy discussions. So, let's take a look at them! Product Updates: Introducing Connected Records feature: Zoho CRM’s Next-Gen UI now includes Connected
Problems with email templates (HTML - Outlook)
Hi there, I've been trying to create a newsletter from the template "Business 4". Everything looks great in the preview, but when I send it to my Outlook inbox, the layout doesn't seems to stick. More particularly: - The line-height is way more reduced, even though I used the line-height tool from the template - Columns but they are sometimes misaligned - Font size is not always the one I've selected. Could you help? Thanks!
Please make it easier to Pause syncing
right now it takes 3 clicks to get there. sounds silly, but can you make it just 2 clicks to get it done instead? thats how dropbox does it, 2 clicks to pause instead of 3.
How to create a Zoho CRM report with 2 child modules
Hi all, Is it possible to create a Zoho CRM report or chart with 2 child modules? After I add the first child module, the + button only adds another parent module. It won't let me add multiple child modules at once. We don't have Zoho Analytics and would
Create static subforms in Zoho CRM: streamline data entry with pre-defined values
Last modified on (9 July, 2025): This feature was available in early access and is currently being rolled out to customers in phases. Currently available for users in the the AU, CA, and SA DCs. It will be enabled for the remaining DCs in the next couple
SalesIQとPageSenseの利用について
初めての投稿で場違いだったらすいません。 弊社ではSalesIQを運用しているのですが、追加でPageSenseの導入もしたいと現場からの声があります。 両サービスともクッキー同意バナーが必要なサービスなのですが 弊社では同意無しに情報はとりませんという方針なので 2つ入れると2つバナーを出す必要がでてきます・・・ 両サービスを運用されてる方があれば運用状況とか教えてほしいです。 PageSenseについては詳細まで機能を理解してないなかでの質問です。
How to integrate Zoho Forms with Zoho CRM on Standard Plan
Hello Zoho Support Team, I am using the Standard Zoho Forms plan (USD 30/user) and I would like to integrate Zoho Forms with Zoho CRM so that certain fields in my forms can be automatically prefilled using data from Deals in CRM. Specifically, I want
CRM : Function to add user name to text field
I have a lookup field in a module that is linked to the CRM users so we can assign a Project Lead to the customer. Sadly Zoho Marketing Automation doesn't sync Lookup fields so I need to extract information from the lookup to text fields: Lookup field
Export PDF File Name
Is it possible to change the default Zoho .pdf naming scheme for inventory items like quotations? Would like to use the the Subject as the default quote name. Is this possible?
How to change the from address from 'no reply' for an email template in CRM
Hi, We have our CRM set up with the from field as sales@XXX. I have just created a series of email templates and sent a test and they are sending from noreply@zoho I have tried searching for how to change the email template but don't have the options
Zoho CRM Client Script - SetCriteria in lookup Field
Hello All One More Zoho CRM Client Script Tips & Trick. Now you can Set the Criteria on Your lookup in zoho CRM, It Comes With a Create Page, Edit Page, and Details Page (Standard). Example:- We have a Room Module that includes Room Name, Status, Campus,
Kaizen #71 - Client Script ZDKs for Detail (Canvas) Page
Hello everyone! Welcome back to another interesting Kaizen post. In this post, we can discuss Client Script ZDKs support for Detail (Canvas) Page. What is Detail (Canvas) Page? A Detail(Canvas) Page allows you to customize the record detail page to your
how to use validation rules in subform
Is it possible to use validation rules for subforms? I tried the following code: entityMap = crmAPIRequest.toMap().get("record"); sum = 0; direct_billing = entityMap.get("direct_billing_details"); response = Map(); for each i in direct_billing { if(i.get("type")
Add Custom Reports To Dashboard or Home Tab
Hi there, I think it would be great to be able to add our custom reports to the Home Tab or Dashboards. Thanks! Chad
Rich-text fields in Zoho CRM
Hello everyone, We're thrilled to announce an important enhancement that will significantly enhance the readability and formatting capabilities of your information: rich text options for multi-line fields. With this update, you can now enjoy a more versatile
Create Lead Button in Zoho CRM Dashboard
Right now to create Leads in the CRM our team is going into the Lead module, selecting the "Create Lead" button, then building out the lead. Is there anyway to add the "Create Lead" button or some sort of short cut to the Zoho CRM Dashboard to cut out
Zoho Reports Duplicating Entries
I have a custom costing tab with a table where we entre invoices. These are under a Heading (PO Subject) and notes added in the form with different line items. In the reports, I have organised the report to group per PO Subject, with the total of the
Validation Rule Not Working for Mandatory Field in Zoho Blueprint
As a Zoho user, we created a validation rule for a specific field. However, we noticed that when we made the same field mandatory within a Blueprint, the validation rule we defined did not work. When we reported this issue to Zoho Support, they stated
Notes Issues
Been having issues with Notes in the CRM. Yesterday it wasn't showing the notes, but it got resolved after a few minutes., Now I have been having a hard time saving notes the whole day. Notes can't be saved by the save button. it's grayed out or not grayed
Export from Contacts module to Products module in Zoho CRM
Good afternoon, I would like to send a number of contact info from the Contacts module into the customized module (tickets to an event) in one operation. I have selected several contacts in the Contact module (people who I have labelled as people I want
Zoho Commerce
Hi, I have zoho one and use Zoho Books. I am very interested in Zoho Commerce , especially with how all is integrated but have a question. I do not want my store to show prices for customers that are not log in. Is there a way to hide the prices if not
Can’t receive emailI c
I have generated a basic for but when I submit it I don’t get a email, I’ve been in the settings and tested me email, all appears correct, can you please help me
Data Capture for Historical Activity (Especially One Lead Downloading Variois reports without Overwriting the info)
Is there a better way in Zoho CRM to capture and archive a lead’s historical activity—specifically whenever they download reports—so that the data is stored without being overwritten?”
Client Script - Updating Field Value in Detail Page of a Lead
Hello, I'm trying to use Client Script To enrich some data of the Lead when one of my User fill the "City" field in the detail page of the Lead. This is my Script: log (value); var response = ZDK.Apps.CRM.Functions.execute("getInfoCitta", { "nomeCitta":
Next Page