Kaizen 169 - Serialization and Schema Management in Queries

Kaizen 169 - Serialization and Schema Management in Queries


Hello everyone!

Welcome back to another post in the Kaizen series!

In Kaizen #166, we discussed handling Variables in Queries and associating the query in Kiosk.
This week, we will discuss Serialization and Schema management in Queries.

Business Scenario

Let's consider the same use case of Delivery Hub discussed in Kaizen #166.

Here, a tele-commerce platform uses Zoho CRM to manage sales and deliveries. When a customer provides their PIN code, the salesperson must confirm with the customer for a nearby post office for package pick-ups and drop-offs in Kiosk.

For this case, we wrote a query with the Source as REST API. When a PIN code was entered, the query dynamically retrieved the list of post offices in that area and displayed it on the Contact's detail page.

Let's take it a step further and see how we can serialize the response.
When you query by entering a PIN code, the response contains all post offices in that area including the ones that are non-operational.

To display only relevant data and leverage the capabilities of the Queries feature, you can serialize the response to display only those post offices that are operational(with the value "DeliveryStatus":"Delivery") along with the names of those post offices.

We will also see how Schema varies based on serialization.

Serialization

Serialization refers to the process of transforming complex data structures into a format that is more meaningful and relevant to your business needs. In Zoho CRM Queries, serialization affects how responses are formatted and what data is included.

Serialization offers the following:
  • Response Customization: By serialization, you can manipulate the output of a query to focus on relevant fields. For example, if a query retrieves multiple post offices, serialization can filter these results to display only those marked as 'deliverable'.
  • Schema Adjustment: When you serialize the response, the schema changes. This allows you to have only relevant data in the serialized output like the required fields, especially while querying a module with multiple relationships.
  • User Experience: Serialization avoids unnecessary information clutter, giving the users only what they need, thereby improving their overall experience.

Example

Consider the example of Delivery Hub. For PIN 110042, the response contains a list of six post offices in that area.

{ Name: 'Badli (North West Delhi)' , Description: null , BranchType: 'Sub Post Office' , DeliveryStatus: 'Non-Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' }
1
:
{ Name: 'Delhi Engg. College' , Description: null , BranchType: 'Sub Post Office' , DeliveryStatus: 'Non-Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' }

{ Name: 'Pehlad Pur' , Description: null , BranchType: 'Branch Post Office' , DeliveryStatus: 'Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' }
3
:
{ Name: 'Samai Pur' , Description: null , BranchType: 'Sub Post Office' , DeliveryStatus: 'Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' }
4
:
{ Name: 'Shahbad Daulatpur' , Description: null , BranchType: 'Branch Post Office' , DeliveryStatus: 'Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' }
5
:
{ Name: 'Siraspur' , Description: null , BranchType: 'Branch Post Office' , DeliveryStatus: 'Delivery' , Circle: 'Delhi' , District: 'North West Delhi' , Division: 'Delhi North' , Region: 'Delhi' , Block: 'Delhi' , State: 'Delhi' , Country: 'India' , Pincode: '110042' }

Now, we will use serialization to display only those post offices that deliver with the value DeliveryStatus = 'Delivery' .
You can serialize the response using JavaScript. Here is the code.

const postOffices = result[0]?.PostOffice;

// Ensure `postOffices` is iterable
const postOfficesArray = Array.isArray(postOffices)
? postOffices
: (postOffices ? Object.values(postOffices) : []);

const filteredResults = [];

// Filter and manually extract `Name` and `DeliveryStatus`
for (const office of postOfficesArray) {
if (office.DeliveryStatus === "Delivery") {
filteredResults.push({ Name: office.Name, DeliveryStatus: office.DeliveryStatus });
}
}

return filteredResults;

Let's see how serialization brings a difference in the output.

Output when fetching all post offices


Serialized output displaying only the name and status of the post offices that deliver

As you can see, serialization makes the output less bloated and a lot more meaningful and relevant.

Schema Management

For every query, the schema is auto-generated. It outlines the structure of the retrieved data and helps identify the path of each field, its CRM field type, and the label.
You can modify the auto-generated schema to suit your requirements better. You can update field labels and types, which helps in presenting data in a more user-friendly way.
For example, if a query returns a field labeled "Deal Stage," you can rename it to "Current Status" for clarity when displaying results on dashboards or reports.
Let's look at the schema when fetching all post offices for a PIN code vs the schema of the serialized response.

Schema before serialization


Schema after serialization


You can see that serializing helps you achieve crisper results.
It shows the CRM field type of every field in the response and its label. You can further customize the schema by changing the field labels to suit your needs.
In the following image, the field label for DeliveryStatus is changed to Status in the serializer which is reflected in the schema.


We hope you found this post useful. Watch this space for more posts on interesting topics.

We love to hear from you! Write to us at support@zohocrm.com.
See you all next week!

Cheers!




-------------------------------------------------------------------------------------------------------------



    • Recent Topics

    • Email Campaigns overview page is missing SENT DATE and # people sent to!

      I would like to see the date the email campaign was sent, so I can understand and track when each email campaign was sent. Right now, unless you go to a contact who received a campaign, you cannot see when the campaign was sent (!!!!!!). So, if my boss
    • SEO recommendation of H1 tag for website tittle

      The exact words are “ It is good practice to place the page title inside the H1tag.” Now I already have one H1 tag on my website but it is not website tittle. In the SEO recommendation that is clear too that I have h1 tag on my page. Now I don’t know
    • How to choose other payment methodes than creditcards

      We have connected stripe as a payment provider in zoho books, booking, commerce and checkout. In stripe we selected al major payment methodes for Belgium (mainly bancontact). However, at checkout customers seems to have only the possibility to pay with
    • Introducing Zia LLM: Zoho’s in-house Generative AI solution for CRM's AI capabilities

      Hello everyone, We're excited to announce the launch of our in-house Large Language Model (LLM) by Zia to power our AI offerings. What is LLM? LLM stands for Large Language Model, a powerful AI technology that processes and generates human-like text based
    • How to call a Creator function which is in a different Creator application?

      How to call a Creator function which is in a different Creator application?
    • Can the code in my "Successful form submission" WF be invoked from a function?

      Can "Successful form submission" be invoked from a function? Data gets into a form manually and programatically. My code in "successful form submission" is good and I want to reuse it/call it, from another function which does Insert Into How to achieve
    • Kaizen #169 - Serialization and Schema Management in Queries

      Hello everyone! Welcome back to another post in the Kaizen series! In Kaizen #166, we discussed handling Variables in Queries and associating the query in Kiosk. This week, we will discuss Serialization and Schema management in Queries. Business Scenario
    • Introducing Keyboard Shortcuts for Zoho CRM

      Dear Customers, We're happy to introduce keyboard shortcuts for Zoho CRM features! Until now, you might have been navigating to modules manually using the mouse, and at times, it could be tedious, especially when you had to search for specific modules
    • Feature Request: Notebooks within notebooks (Tree-like structure)

      Dear Zoho! I already migrated all my stuff from Google Keep, Im really fond of Zoho Notebook so far. One thing that could make the service much more powerful is multi-level notebooks (or tree like structure). For example, entering into Notebook named
    • Can't get authorization for Sandbox environment using the self client

      Hello, After creating a self client, and following the client-credentials method (as it's not optimat to manually generate a code for every 10 minutes), after inputting the sandbox org id for SOID parameter, im getting the error: "error": "no_org". For
    • Create landing pages from Zoho Marketing Plus

      Hey everyone, Over the last few months, we've introduced various features and enhancements to bolster the marketing capabilities of Zoho Marketing Plus and make it simpler for everyone. To that end, we're excited to announce that Zoho LandingPage is now
    • Custom service report or Zoho forms integration

      Hello, So far the experience with Zoho FSM and the integration with Books has been good, however there are limitations with service reports. As with my business, many organisations send technicians to different types of jobs that call for a different
    • Email tracking subdomain

      The Email Tracking configuration screen of the ZeptoMail asks for a subdomain. I have gone through the documentation but could not find more information about how that subdomain is used by ZeptoMail to track the emails. Can someone throw some light about
    • Chart View group X-axis values above a value

      I have a data set with X values ranging from 0 up to 300-400, the Y values are an AVG of the values for the given X. I am interested in the values at the low end of the scale, say 0-10 and want the X values 10 and greater to be grouped into a single category
    • How do I get the Text Account name instead of the Reference number?

      Good Morning everyone! I am very new to zoho analytics. I'm trying to create some pivot tables and when I add the Account or Division name it comes up as a reference number. From my research, I need to use a lookup. I'm having a really hard time understanding
    • Custom API - Need to create a string return value, not only MAP

      @Support: When creating a Custom API it only allows a return from a function of MAP type. The service I'm using requires a string return, how can this be achieved?
    • missing video-urgent

      hi..I have a problem regarding zoho meeting. I already record almost 2hrs for my interview session. After end my session, i'm stop the recording. Its happened when i didn't received any meeting recording at my email.But i received recording 7minutes after
    • Duplicate New Ticket Emails

      I am getting two Ticket emails when a ticket is created. The first one goes to me as the Admin helpdesk@ And because I am an Agent as well it also send to helpdesk@, support1@ and support2@ Is there any way to stop this?
    • Ticket Response Email Template

      Is there a way to have an email template automatically selected when I click on Reply for a ticket?
    • Unpublishing Job Post for LinkedIn

      Hi, We have experienced issue with the above. We did unpublish a job in Recruit but it still appear under Job section in our LinkedIn page. It did not remove from LinkedIn as it should be.  Please check and advise. Regards, Snyder 
    • Power of Automation :: Automatically start / pause / stop timer on task status update.

      Hello Everyone, A Custom function is a user-written set of code to achieve a specific requirement. Set the required conditions needed as when to trigger using the Workflow rules (be it Tasks / Project) and associate the custom function to it. Requirement:-
    • Editor limitations to define screen types

      Guys I have noticed that even in version 2.0 of the editor (which is this new one we use) we still have a lot to improve... When I compare to some more global solutions like Wix, Zyro, Go Daddy, Squarespace and Weebly feel that we have some limitations
    • Dúvidas do Zoho Creator

      Pessoal, Estou colocando um tópico para dúvidas do Zoho Creator. Um abraço, Leandro
    • Tropicalize Books

      Books is an incredibly powerful tool that works well in many countries. But I feel that it is a product that is not yet "tropicalized" for Brazil as we speak (this would be like adapting the local reality). We have many strong competitors who do more
    • Automatic Sitemap Generation

      Guys are all right? Doesn't make sense for me to have to generate a map site and upload it... because it's not automatically generated just as it is done in WIX? where the customer doesn’t have to worry about this.
    • SEO improvements with ZIA

      Are you okay? I would like to bring an idea that would be amazing to improve the product that is the possibility of being able to improve the SEO of the pages (this of each page or each article on the blog) through ZIA so that it could create page Summary
    • Automatically updating field(s) of lookup module

      I have a lookup field, which also pulls through the Status field from the linked record. When the lookup is first done, the Status is pulled through - this works perfectly. If that Status is later updated, the lookup field does not update as well. As
    • Initiating a SalesIQ Zobot from a custom button on Zoho Sites

      I have created a Zobot set to initiate on a custom action called "Fast_Answers". On Zoho Sites, I created a code snippet button and set it to on-click run the event called "Fast_Answers". I installed the SalesIQ integration code into the Zoho Sites Page
    • Zoho Desk -> Zoho Analytics : Where is the field for "Layout" ?

      I have many different layouts on my helpdesks and I want to be able to identify the stats for each one, however I can not file the field in the raw data from the Zoho Desk datasource. I thought it might be under "Tickets" but there is nothing. There is
    • Set resolution mandatory field

      Hi,  i have 2 questions:) : - i want to set the resolution field mandatory before close the ticket. Because for now, i can close the ticket without writing how i solve it - how can i setup zoho desk to receive ticket by email(e.g. clients sent email to support@mydomain.com) and it create a ticket in zoho desk
    • Impuesto automatico en cotizaciones

      Buen dia Mi pregunta es como se puede poner alguna operacion para que las cotizaciones me salgan automaticamente con impuestos ya que uno al cargarla al final tienen que añadir el porcentaje de impuesto Saludos
    • Zoho Assist "Agree and Download" Button "Greyed Out" ("Light Blued" Out)

      Anyone else having issue where support clients are unable to click "Agree and Download" to access the client so that we can provide remote support? This is for "on demand" support via accessing the support page and entering the support key and name. This
    • Project Billing with the Staff Hours Method in Zoho Projects

      The Staff Hours Billing Method in Zoho Projects allows you to bill your clients based on the actual time spent by each team member on a project, at the rate set for each user. This is useful for projects where different skill sets are needed and service
    • Creator Subform to CRM Subform

      Hello all, Has anyone successfully written data from a Creator Subform into CRM subform? I have been able to get the rows to populate but none of the data will come through. I'll add my code and the result in CRM. Creator Subform is 'Delivery_Receiving_Hours'.
    • custom fields not populating from deluge script into invoice

      Hello, I've created some Deluge script that is meant to take a few inputted invoice custom fields and calculate a few others. I can see when I execute the function that my inputted custom fields are being passed, yet im still ending up with all "null"
    • tax summation function - getting error

      Hello, I'm trying to create a function that adds all of individual tax rates from a few jurisdictions. I'm getting an error on line 9 - Value is empty and 'get' function cannot be applied. I've checked that I have data in each of the required fields,
    • Backstage / Zoho Books integration

      Hello. We have Zoho One and have slowly started using Backstage. Loving it. Problem is, we have ZERO accounting control over what is sold through this product. When will we be able to connect it to our existing Zoho Books tenant? Thank you very much!
    • Getting list of calendar events over api for zoho mail calendar

      Hi, I am using just Zoho mail without using Zoho CRM. I wanted to get all events booked in my zoho mail calendar through an api at regular intervals. I could find such API support for Zoho CRM calendar but not for zoho mail calendar. Can you kindly let
    • Allocate emails to user in a shared mailbox

      Hi, This might be obvious, but I cannot find the answer. I have 3 shared mailboxes so any team member can see the emails. Is there a way of allocating a specific email to a user so that it is their responsibility to deal with it? Thanks in advance.
    • Introducing Zoho Campaigns' own gateway for SMS campaigns

      We are excited to announce the launch of our SMS Gateway to send SMS through Zoho Campaigns. We have also made a few other changes in our current SMS Campaign model to improve your over all user experience. These updates are planned with an aim to expand
    • Next Page