Kaizen 190 Queries in Custom Related Lists

Kaizen 190 Queries in Custom Related Lists


Hello everyone!

Welcome back to another week of Kaizen! 

This week, we will discuss yet another interesting enhancement to Queries.

As you all know, Queries allow you to dynamically retrieve data from CRM as well as third-party services directly within our CRM platform. 

Remember how we discussed the use case of displaying the nearby post offices based on the shipping code? We used query variables and associated this query with the Decision component of Kiosk in Kaizen #166.

In Kaizen #169, we used serialization to fine-tune the same query to display only those post offices that delivered to a particular shipping code.

Falling in love with contextual data? This post will make sure you do!

Custom Related Lists are now powered by Queries!

Custom related lists have long been a powerful way to present relevant and contextual information right alongside the CRM records.

They allow you to display additional, context-specific information whether it’s from another module, a third-party service, or a custom integration. 

We’re now taking that power to the next level. You can now create related lists that are powered by Queries, meaning they can dynamically fetch data from other modules, external services, or custom integrations, at runtime!

Let's see this in action, as always!

Use case: Show deliverable post offices based on Shipping Code in a Related List

Imagine you’ve built a custom module called Orders to track all product shipments. Now, you'd like to display a list of nearby post offices that can deliver to the order’s Shipping Code, and you want this list to update automatically for each record.

You can create a query that pulls in post office data from an external API, with the Shipping Code passed as a variable at runtime. 

Since we're using an external source, you must add this source to Trusted Domain and Sources. This enables the query to make the external API call and fetch the required details.

Trusted Domain


Add Source


The Query


Serializer and Query's Response


You can see that the query fetches all the post offices in that PIN code and the serializer displays only those with the delivery status 'Delivery'. 

Let us use this query in a related list to display contextual data alongside the record itself.

Create a custom Related List

  1. Open a record in your Orders module and click the three-dot menu at the top right.


  2. Select Add Related List.
  3. In the dialog, choose Queries and pick your query from the list.

  4. Give your related list a name.
  5. For variable mapping, use merge fields to assign value to the variable dynamically. In our example, we are assigning the Shipping Code value to the query variable(Mailing_Zip).

  6. Click Done and Save.
  7. Your new related list will appear on the left panel, and you can reorder it as needed. The list will now update automatically based on the Shipping Code for each order, pulling fresh data every time you view a record.


Each time you view an order, the related list will fetch real-time post office data using the shipping code for that specific record; no manual updates are needed.



Using Queries in Related Lists opens up endless possibilities. With the power of Queries in related lists, you can: 
  • Avoid static data as related lists become truly dynamic.
  • Display contextual data - data that is relevant to the record.
  • Negate the need for lookup fields as queries can fetch data from external services and CRM modules seamlessly.


We hope you liked this post. Let us know what you think in the comments or write to us at support@zohocrm.com.

If you have any interesting use cases of your own, please do share them with us and the community.

Cheers!


    • Sticky Posts

    • Kaizen #197: Frequently Asked Questions on GraphQL APIs

      🎊 Nearing 200th Kaizen Post – We want to hear from you! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Kaizen #198: Using Client Script for Custom Validation in Blueprint

      Nearing 200th Kaizen Post – 1 More to the Big Two-Oh-Oh! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Celebrating 200 posts of Kaizen! Share your ideas for the milestone post

      Hello Developers, We launched the Kaizen series in 2019 to share helpful content to support your Zoho CRM development journey. Staying true to its spirit—Kaizen Series: Continuous Improvement for Developer Experience—we've shared everything from FAQs
    • Kaizen #193: Creating different fields in Zoho CRM through API

      🎊 Nearing 200th Kaizen Post – We want to hear from you! Do you have any questions, suggestions, or topics you would like us to cover in future posts? Your insights and suggestions help us shape future content and make this series better for everyone.
    • Client Script | Update - Introducing Commands in Client Script!

      Have you ever wished you could trigger Client Script from contexts other than just the supported pages and events? Have you ever wanted to leverage the advantage of Client Script at your finger tip? Discover the power of Client Script - Commands! Commands