Kaizen #206 - Answering your Questions | Displaying Related Purchase Orders from Zoho Books in CRM Deals using Queries

Kaizen #206 - Answering your Questions | Displaying Related Purchase Orders from Zoho Books in CRM Deals using Queries


Hello everyone!
We're back with another post in the Kaizen series.
We're grateful for the feedback we received from all of you!

One of the questions we received was "I would like to see the list of Purchase Orders in Zoho Books for a Deal in CRM."

We will discuss how to achieve this using the Queries feature in Zoho CRM.

Scenario

In many organizations, a single Deal in Zoho CRM may correspond to one or more Purchase Orders(POs) in Zoho Books. To get a real-time view of all POs associated with a Deal in CRM, we can leverage the Queries feature under Setup > Developer Hub > Queries, and custom related lists.

1. CRM and Zoho Books Integration

Zoho CRM and Books integration allows you to
  • View POs, invoices, and payments for deals directly in CRM
  • Synchronize financial data between CRM deals and Books POs
  • Automate the mapping of deals to POs via custom fields
To create this connection,
  1. Go to Setup > Developer Hub > Connections
  2. Create a connection to Books(OAuth) with the scopes ZohoBooks.contacts.All and ZohoBooks.purchaseorders.All.

2. Prerequisites

Before creating the query and automation, you must have the following ready:
  1. Zoho Books organization ID – needed for REST API calls.
  2. Custom field in Books PO module:
    Field Name: CRM Deal ID
    Type: Single-line
    Purpose: Store the CRM deal ID that each PO relates to.
    Why do we need this custom field?
    By default, Books POs are not directly linked to CRM Deals. To bridge this gap, we create a custom single-line field(CRM Deal ID) in Books POs to store the CRM Deal’s record ID. This makes it possible to filter POs in queries(cf_crm_deal_id == {{deal_ID}}) and reliably display only the related POs in CRM.

    You can store the record ID of the deal in CRM in this field either manually or via a custom function. When you use a custom function, use the Update a Purchase Order API to update the CRM Deal ID field in Books with the record ID of the deal in CRM. You can then associate this function to a button or automation to constantly update the PO in Books every time a deal in CRM is created or updated in CRM. You can also use Zoho Flow to achieve this instead of a function.
  3. Trusted domain and source:
    1. Ensure you have added Books API domain to trusted domain for API calls.

    2. Add Zoho Books as the source of the query to get the PO details from Books. You can add the Books' organization ID as a parameter either here or while creating the query.

3. Single Deal, Multiple POs

Scenario

  • A CRM deal requires multiple POs from different vendors.
  • Each PO in Books stores the same Deal ID in the CRM Deal ID field.
  • This allows a related list in CRM to show all POs associated with the deal.

Why a Single-line Field Works?

  • Each PO references one deal.
  • Queries in CRM can filter using cf_crm_deal_id == {{deal_ID}}. cf_crm_deal_id is the API name of the custom field in PO of Books. You can find it under Setup > Purchases > Purchase Orders > {the custom field} > Edit.
  • Works reliably for related list display.

4. Creating a REST API Query in CRM

Since we will use Books API to get the list of POs, we will create a REST API type query.

  1. Go to Setup > Developer Hub > Queries > Create Query.
  2. Enter the details as shown in the following image:

  3. Choose the Books source that you added recently.
  4. Give a name for the query.
  5. The API name will be auto-populated, and the URL will be populated from the source.
  6. Enter the endpoint to access the resource from Books. In our case, purchaseorders.
  7. To filter based on the value in the CRM Deal ID field in Books, enter the parameter as cf_crm_deal_id and its value as a variable. This variable takes the Deal's record ID as the value during run time. This ensures that the query takes the deal residing in the CRM Deal ID(which is also the record ID of the deal in CRM) field in Books and filters only those POs related to this Deal.
  8. If you have not given org_id as a parameter while creating the source, include it here.
  9. Click Next. You will get a pop-up asking for the value to the variable cf_crm_deal_id. Give a value to see the query in action.
  10. The query returns the list of POs from Books that are related to this particular deal in CRM.
  11. Save the query.

5. Serializing(to return a table for the related list)

Serializer allows you to manipulate the response of the query using Javascript.
In our example, the raw response of the query will contain the POs from Books for a deal in CRM as an array with many fields.
For example, the deal with CRM record ID 3652397000017912047 has two POs in Books viz, PO-00001 and PO-00003. The raw response before serialization is as follows.


But, to associate this response with a related list, we don't need all the fields. We can use the serializer to modify this response and use only the required fields.
The following image shows the serialized response.


Click Save and configure the Schema.


Click Save to save the query.

6. Adding the Query to a Related List

Now that we have the query ready, let's associate this with a related list in the Deals module in CRM to contextually view the POs of the Deal in Books.
  1. Navigate to the Deals module in CRM.
  2. Click the three-dot icon on the right corner of the record, and click Add Related List. Alternatively, you can also click the Add Related List option on the left in the Related List pane.

  3. From the pop-up, select Queries.

  4. From the list of available queries, select the Get Purchase Orders query you created and click Associate.

  5. Give a name for the related list.
  6. Under Variable Mapping, type #(to view merge fields) to get the list of modules available. Choose Deals and the Deal Id field. This means that the record ID of the deal will be passed as the value of the cf_crm_deal_id variable at runtime. The query will then fetch the list of POs for this Deal ID from Books, and display it in this related list.

  7. Click Save and you will see the related list under the Related Lists section of the record.

  8. Reload the page to see the query in action.

Automation Options

You can automatically update the CRM Deal ID in Books POs when a deal is created or a PO is raised.

1. Using Function

  • Function triggers on deal creation or a button click in CRM.
  • Fetches the PO in Books and updates the CRM Deal ID field using the Books connection.

2. Using Zoho Flow

  • Event: Deal created or updated in CRM.
  • Action: Update the corresponding PO(s) in Books.
  • Works without writing Deluge code.
Both methods require the Books connection and organization ID.

Summary/Best Practices

  • Single Deal, Multiple POs: Use single-line CRM Deal ID field in Books.
  • Queries and serializer: Filter POs based on cf_crm_deal_id == {{deal_ID}}.
  • Automation: Use functions or Zoho Flow for real-time updates.
  • Multi-Deal, Single PO: Not supported for related lists; use custom reporting instead.

This setup ensures that sales and finance teams can see all POs for a deal directly in CRM without manual reconciliation.


We hope this post answered your question and you found this useful.
Let us know what you think in the comments or write to us at support@zohocrm.com.


Cheers!


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










    • Sticky Posts

    • Announcing the new SKILL.md for Zoho CRM and the updated OAS repository!

      We are introducing a new zoho-crm skill to make working with Zoho CRM Developer tools (like APIs, functions, widgets, client scripts, queries etc) easier and faster, with the help of AI in your preferred AI harness like Claude Code, Codex, Cursor, VSCode
    • Kaizen #261 : Using Zoho CRM Skill to generate complex COQL queries

      Hello everyone, In the previous Kaizen posts, we introduced the zoho-crm SKILL.md and discussed how it can help you when you are working with Zoho CRM APIs and Client Script. In this Kaizen, we will focus on using the Zoho CRM `SKILL.md` with GitHub Copilot
    • Kaizen #256 - Build an Arrival Readiness Web Tab in Zoho CRM

      Hi everyone! Welcome back to the Kaizen series! In the post, we discuss a use case in hospitality industry: how an Arrival Readiness web tab widget can be used to let reception staff identify and resolve issues before arrival of guests. Use case In the
    • 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.
    • Kaizen #226: Using ZRC in Client Script

      Hello everyone! Welcome to another week of Kaizen. In today's post, lets see what is ZRC (Zoho Request Client) and how we can use ZRC methods in Client Script to get inputs from a Salesperson and update the Lead status with a single button click. In this
    • Recent Topics

    • How to record refund of expenses in zoho books

      Hi, i bought a air ticket and recorded the expense in money out. The ticket was cancelled and the fare (after deducting cancellation charges) was credited back to my bank account directly. How can i record the the above transaction?
    • Multiple subscription plan line items in Zoho Billing quotes

      I run an IT company and sell a lot of licences. A client might have multiple subscription plans including software licences in different categories. A client might have Microsoft licences, antivirus licences, web hosting and maintenance package services.
    • Invoicing multiple expense items as a single line item

            My client would like me to invoice them for multiple expense items on a single line item on an invoice.  Can this be done?  I know I can import billable expenses to an invoice, but I don't know how to show them as a single line item or have them
    • Rename default fields in Zoho CRM

      Hi, I'm setting up Zoho CRM for an Australian company. They are perplexed by the names of the address fields, e.g. "Billing Province" (we would call it Billing State) and "Billing City" (we would call it Billing Surbub). I would like to request that these
    • Do "shortcuts" or symlinks exist in Workdrive?

      I need some kind of link or shortcut to put into folders that point back to original files or folders, is there any way in Workdrive to do this?
    • Contact Lookup Mapping to Custom Module CRM via DataPrep

      Hi DataPrep Team, I'm facing an issue with Contact module lookup mapping to a custom module during the DataPrep-to-CRM migration. As per the documentation, the mapping format for lookup fields should be: <Lookup_Field_API_Name>.<Lookup_Module_API_Name>
    • Zoho ERP | Product updates | August 2026

      Hello users, What’s new in Zoho ERP this month? From Account Registers to new reports, we’ve packed this release with updates worth checking out. Take a look at what’s new and see what’s in store for your business. Introducing Account Registers Account
    • Kaizen #99 - Render Widgets Using Client Script

      Hello everyone! Welcome back to another interesting post. In this post, let us see how you can render Widgets using Client Script. Widgets are embeddable UI components that you can create and add to your Zoho CRM. You can use widgets to perform functions
    • Customer portal: recommended way to scope lookup fields to the logged-in client?

      Hi all, I'm building a customer portal on Creator for our clients (we're a esting lab, so each client has their own sites, contacts and jobs). Planning stage, so I'd rather get the approach right before I build it. The portal forms need several lookup
    • Support for Custom Fonts in Zoho Recruit Career Site and Candidate Portal

      Dear Zoho Recruit Team, I hope you're doing well. We would like to request the ability to use custom fonts in the Zoho Recruit Career Site and Candidate Portal. Currently only the default fonts (Roboto, Lato, and Montserrat) are available. While these
    • Introducing the Zoho Contracts API Collection on Postman

      We are happy to announce that the Zoho Contracts API collection is now available on Postman. You can explore, test, and debug Zoho Contracts APIs without writing application code. What's in the collection Ready-to-use requests for Contracts, Counterparties,
    • Zeptomail in the blacklists

      Hello, I noticed some hard bounces while sending emails, and upon checking the details, I see that we have been added to the blacklists of certain spam lists: Bounce category: Policy failure Reason: ip-issues Message: 5.7.1 Service unavailable; client
    • Add Payment Information (like Bank details)

      I am using the Free plan of Zoho Books. I need to add the bank details/ UPI details on the invoice. How can I do that. I have added the details in the Bank Section.
    • How does Recur setting affect execution time of time based workflow rules.

      When setting a workflow rule based on Date/Time field, the Recur setting does not seem to make sense. If I want the rule to execute at a specific amount of days relative to a date field, what exactly would the recurrence be? That point in time would only
    • Canvas Ungroup is No Longer an Option - Can we Bring it Back?

      You used to be able to ungroup a Group in ZOHO Canvas, but now you have to delete the group and completely start over (re-add the fields, re-place them, regroup them, readjust the group as you want it/reformat) instead of ungroup, move or delete only
    • Reserve Your Spot for the Zoho Recruit India Virtual Meetup

      The Zoho Recruit Meetup India is happening virtually on October 15, 2026, and registrations are now open! This meetup is a chance for Zoho Recruit users across India to come together, catch up on what’s new, learn better ways to use Recruit, and have
    • Account recovery using trusted Zoho applications

      We know forgetting your password can be frustrating. So to make account recovery even simpler and more seamless, we're introducing recovery through Zoho mobile apps; in addition to the existing OTP options using email address or mobile number. Please
    • Introducing Omnichannel Subscription

      Your customers may choose to subscribe through different marketplaces such as Google Play or App Store. As your business expands, managing these subscriptions can become increasingly complex. To make it easier, we are introducing the Omnichannel Subscription
    • WhatsApp Business Message Pricing Update: Effective October 1, 2026

      Hi everyone, Starting October 1, 2026, Meta is updating how WhatsApp Business messages are charged. This guide explains the new per-message pricing model, how message categories work, and what changes for service messages specifically. How Meta charges
    • [Webinar] Automated label merging

      Live webinar on October 8, 2026 | Time: 2 PM IST | 2 PM EDT Hi, Businesses that rely on labels for shipping, inventory, or events often struggle with rigid layouts, disconnected data sources, printing the right quantity, and adapting labels for different
    • zFlow_DateTime

      This kind weird since our Flow is RUNNING FOR ALMOST A YEAR and suddenly, our auto plotting of events on Creator Calendar isn't working. Our team can't afford doing manual thing since we handle lot of service tickets. We suspect that there is something
    • What's New in Zoho Inventory | July & August 2026

      Hello users, The July and August 2026 releases bring a range of new features and improvements across the product. From the Nigeria Edition and Super Admin enhancements to Sri Lanka IRD-compliant invoicing, Loyalty Program Management, and improvements
    • Roles and Privileges in Zoho Mail: Define and control administrative access in your organization

      Imagine a growing organization where the IT team needs to manage users, the support team needs to handle spam settings, and the group admins need to oversee email groups, all without giving everyone full access to the Admin Console. This can be achieved
    • Keep sensitive PDFs protected with Zoho PDF Editor

      PDFs often contain confidential information in the form of financial reports, business proposals, contracts, or forms. Zoho PDF Editor helps you keep that information under control with password protection. With two layers of protection, you can decide
    • Enrich your contact and company details automatically using the Data Enrichment topping

      Greetings, I hope you're all doing well. We're happy to announce the latest topping we've added to Bigin: The Data Enrichment topping, powered by WebAmigo. This topping helps you automatically enhance your contact and company records in Bigin. By leveraging
    • CV Parsing

      Hi guys, I parsed my cvs through Rchilli. What can I use now that they have ended their association with you?
    • Change default "Sort by"

      Is there a way to change the default "sort by" when searching across modules?" in Zoho CRM? Currently the default sort method is "Modified time" but i would like to utilize the second option of "relevance" as the sort by default and not have to change
    • Document Approval Workflow for Non-Users

      Our organisation has not added client users yet to Zoho but we are currently exploring how we can use the document Review and Approval Workflow to send out project updates to clients. While testing, we found that we can only pick users as approvers. Is
    • Zoho Learn - Enable Keep Aspect Ratio by Default

      Hi Learn team, Is there a way to enable "Keep aspect ratio" in Image Options by default? It's really frustrating to have to change this for every image. Realistically, who wouldn't appraciate this?
    • Tip #91 – Let customers join sessions directly from your website with the Customer Widget – 'Insider Insights'

      Hello Zoho Assist Community! When a customer needs remote support, the last thing you want is for them to fumble through an email invitation or navigate to an unfamiliar webpage just to join a session. Every extra step is a moment of friction, and for
    • Profile picture unable to be seen by other colleague.

      Hi, As per title, I'm having problem where my profile pic doesn't show from other colleague account. However, when I uploaded the pic from zoho web, it is showed in my phone apps. Still, other colleagues cant see my profile pic. Please help. Thanks,
    • Mute notifications to followers knowledge base/help center

      Good morning Zoho, We are in the midst of a rebranding. This requires updating all of our knowledge base articles with new screenshots etc. In other words: They are all updated. This means all our customers that follow these articles are spammed with
    • Global Constants / Variables

      It would be great if there were a Global Constant feature. The idea here is for managing constants that are used in multiple Flows and Subflows, but might change over time. The idea is that the change could be made in one place and cascade to all future
    • Item/service subtotal

      Just discovered & really pleased that we can drag to re-order the line items in Sales orders & Invoices, a very nice feature which doesn't seem to be documented? It would be nice to be able to insert a subtotal as a line item to complete this great feature
    • Unable to change alias in the from field on the ZOHO mac app

      I have 1 main mail address, and 3 alias's. on the web mailbox when I create a new email, I can select the alias's from the dropdown in the from field. On the app no dropdown is available.
    • Ask the Experts 33: Ticketing in Zoho Desk

      Every customer interaction begins through one of these channels: email or a phone call, a web form, an instant message, a social media, or a visit to your self-service portal. Bringing these interactions together and managing them in the right context
    • Workflow Automation Not Triggering

      My Zoho CRM workflow sometimes doesn’t trigger when a record is updated, even though the workflow criteria appear to be met. What should I check to find out why the workflow is being skipped?
    • Migrating from Zoho Checkout to Zoho Billing

      I have an active Zoho Checkout account where I'm charging customers for subscriptions. Now I'm looking to upgrade and only use Zoho BIlling, in which my account in on read only mode at the moment. I can see is also tracking the customers and its payments.
    • Issues with Zoho Insights and email template web links

      Is anyone else out there having the same issue we're experiencing? When we send out an email template, Zoho insights is converting the URLs from the URL we insert in to the template in to one of the form https://mailer1.zohoinsights.com/ocgeturl/2d6f.327230a?l=0ed7f050-5b31-11eb-a1a...
    • Let's Talk Recruit: Exploring AI in the Zoho Recruit mobile app

      Welcome back to Let's Talk Recruit! Ever had to look up a candidate's details right before a meeting? Or wanted to check your hiring pipeline while you're away from your desk? Recruiters are constantly on the move, and keeping up with everything can be
    • Next Page