Kaizen 206 - Answering your Questions | Displaying Related Purchase Orders from Zoho Books in CRM D

Kaizen 206 - Answering your Questions | Displaying Related Purchase Orders from Zoho Books in CRM D


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

    • 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

    Nederlandse Hulpbronnen


      • Recent Topics

      • Pivot Chart seems to show "old" data - how do I make it update?

        I wonder how to make a Pivot Chart "update" its data contents. Here is the background: I need to report a subset of data that is so complicated that it is easier to make a calculation and put the result in a "reporting form", and then display the data from that form.  So, I get data from the "original form" GRANTS, make some calculations and put the result in the "reporting form" PERIOD.  Now I can watch the result in a list called LIST, which works fine. The list LIST shows that form PERIOD contains
      • Upcoming Changes to LinkedIn Parsing in Resume Extractor

        Starting 31 July 2025, the Zoho Recruit Resume Extractor will no longer support direct parsing of candidate data from LinkedIn profiles. Why Is This Change Needed? In accordance with LinkedIn’s platform policies, extracting profile data through browser
      • Is there a way to map complex product variants from Magento into Zoho CRM without losing SKU-level details?

        Hi everyone, I’m working on a Magento-based store that uses highly detailed product variants, and I’m struggling to map them into Zoho CRM without losing SKU-level details. The problem is that variants often collapse into single entries, which affects
      • how to create view in leads module to that will show all leads + converted leads?

        is it possible to make custom view that combine all leads + converted leads? how to do that
      • Deal Stage component/widget/whatever it is... event

        Deal Stages I am trying to access the event and value of this component. I can do it by changing the Stage field but users can also change a Deal Stage via this component and I need to be able to capture both values. Clicking on 'Verbal' for instance,
      • Reply and react to comments

        Hi everyone! We're excited to bring to you a couple of new features that'll make your sprint process simpler. A cloud application brings with it an array of social media features that can be efficiently used in your organizational setup. As an agile scrum
      • Announcing Early Access to "Zoho CRM for Everyone" — A new and exciting update to Zoho CRM

        Zoho CRM For Everyone is now officially available to all customers, and the Early Access Program has come to a close. We want to extend our sincere thanks to everyone who participated in the program. Your valuable feedback played a key role in shaping
      • Avalara Sales Tax integration - AVATAX

        Just wondering if anyone else is having troubles with this integration?  Seems as though Avalara changed their billing process, unbeknownst to Zoho, and now ALL transactions are counted by Avalara, not just transactions in a taxable jurisdiction.  This caused a huge price adjustment billed to us by Avalara within a month of us signing up.  And Avalara is not cheap to begin with! Avalara has been great in waiving that increase, but there seems to be no fix.  Zoho is aware of the problem, but slow
      • Invalid value passed for description

        Dear Sir, When I am entering the purchase bill , the following message showing "Invalid value passed for description" what should I do ? I am attaching screenshot. With Regards, Harish harish@cracku.in 7978841636
      • Zoho Creator - 2024 Release Projection 1

        Hello everyone! As we enter 2024, we'd like to extend our warmest wishes for success and prosperity. Your fantastic response to our Product Roadmap page last year has been incredibly motivating. Continuing on this path, we're excited to share a glimpse
      • Automation Assistance for Zoho Form Integration and Workflow

        Hi, We are currently using a Zoho Form to send out our Global Credit Application and would like to automate the process further. Specifically, we’d like the ABN number submitted through the form to automatically populate the GST/VAT Number field in Zoho
      • COQL does not return queryable value if the result set is empty

        See linked video for running code illustration of the problem: https://workdrive.zohoexternal.com/external/d49bb40033b43b288d56fdf843095b7c65b28391d3ec5d09c854f416d853003d Moderation update: We are appending the comment that was removed, to add context
      • Zoho CRMでの商談の管理のしかたについて初歩的な質問です。

        先月からZoho CRMを試験的に導入して運用しています。 商談の管理(運用?)の仕方について教えてください。 商談の数が増えてくると、ダッシュボードの「ステージ別進捗状況」にどんどん過去の商談が蓄積されてくると思うのですが、 現在動きのあるものを中心に確認したくなる気がします。 そのあたりについては、どのように運用が一般的なのでしょうか? アドバイスいただけるととてもありがたいです。 よろしくお願いします。
      • Composite Items & Purchase Orders

        The Composite Item is great way to bundle different products and services into a single line and sell it as a single line item in Estimates, Sales Orders and Invoices. However, on the other side - i,e,. Purchasing - this item creates quite a bit of a
      • using custom function is it possible to update the created by field in Zoho Crm custom module

        using custom function is it possible to update the created by field in Zoho Crm custom module
      • Slow Sloww Slowwww Responses

        Good day, Has anyone been experiencing slow responses from support? Since Thursday I migrated my Whats app to Sales Iq and I had to synch with Social to get the otp they were sending. Apparently What's app can't be automatically added so I reached out
      • You have exceeded the maximum number of attempts for this action. Please retry doing the same in 30 minutes.

        When one of Zoho Books user tries to select a vendor, recording a new bill, these message appears: You have exceeded the maximum number of attempts for this action. Please retry doing the same in 30 minutes. Other user, at the same time, but different
      • Enable Conversation Context Retention for SalesIQ Answer Bots

        Hello Zoho SalesIQ Team, We hope you are doing well. We have noticed that SalesIQ bots currently fail to maintain conversation context in Hebrew. For example, when we follow up on a previous answer or ask for clarification in Hebrew, the bot either provides
      • Automatic Hebrew Small Talk Setup Without Duplicate Term Errors & Manual Configuration

        Dear Zoho SalesIQ Team, Greetings, We would like to request an enhancement to the Small Talk feature in Zoho SalesIQ, specifically for Hebrew language support. Current Challenge: When setting up Small Talk for Hebrew, we encounter multiple issues: Simple
      • Should I Add Leads in Bigin?

        ok, first off I'm new here. I just started using Bigin. I'm debating if it's appropriate to enter leads. by leads I mean a list of contacts that I have not yet reached out to...it's a cold calling list.  if I enter them I can track them (I understand
      • Zoho Books - Perform a validation check before an invoice is marked as sent or sent

        Allow the validation rules to apply to button actions. For example: an invoice could not be sent or marked as sent if it has an empty value in a custom field. (The field could remain blank while it is being worked on.)
      • Flow error "given url is wrong"

        when I setup a flow to update a task status, I get an error when it runs that says "given url is wrong."
      • Upgrade Zoho Desk Agent-Side Answer Bot to GenAI

        Hello Zoho Desk Team, We hope you're doing well. Following the recent announcements and rollout of the GenAI-based Answer Bot in Zoho SalesIQ (Nova '25), we’d like to formally request a similar upgrade for the Answer Bot used by agents inside Zoho Desk.
      • Bigin Android app update: Email filters enhancement, change owner for related records.

        Hello, everyone! In the most recent Bigin Android app update, we have introduced additional email filters and an option to change the owner of related records. Email filters: We have now brought in support for 'All Emails' and 'Added from Widgets' filter
      • How can I get all conversations and comments of a Zoho Desk ticket using ZOHODESK

        Hi everyone, Currently, I am developing a Zoho Desk extension, and I am following the guide available at https://www.zoho.com/desk/extensions/guide/#ticket-object. While working with Zoho Desk, I have noticed that I can only retrieve the general information
      • AI & Zoho Recruit

        Hello, I guess we all are using AI in our personal and professional lives. Now, let's imagine. Recruitment is just a succession of stages and steps. For which step would you like to see AI implemented into Zoho Recruit ? I'll start : - Automatic translation
      • Workdrive and ChatGPT Team Synced Connectors

        Hi, we want to be able to integrate Zoho Workdrive with OpenAI’s ChatGPT Team plan. Google Drive and OneDrive both offer this, zoho please catch up asap. We dont want to have to put our company files in google drive, we want to allow chatgpt Team edition
      • widget url 404'ing

        I'm creating a widget for the first time. When I grab the url from the base url section of the widget builder and append /widget.html it 404's Just wrote a very basic test. I have a folder structure app.zip - widget.html --js/app.js /widget.html <!DOCTYPE
      • Unable to Edit Pick-List Items in Custom Project Field(s)

        I can edit most fields normally, but if I try to edit - in any way - a Pick List field, I just get this error: To be perfectly clear, I'm trying to edit an existing Pick List field (adding or removing items), not adding a new instance. If I rename it,
      • How to display results from zoho.crm.searchRecords in message window

        Hello, I've created a custom function which is linked to a custom button which pulls a date from our contacts module and searches a date field in our quotes module and returns all records matching the date. My issue is, how to I get this to display the
      • Domain Transfer

        Hello there! I wanted to know if I can transfer my domain from Zoho to other hosting providers or use a different hosting provider instead of zoho's services.
      • Select CRM Custom Module in Zoho Creator

        I have a custom module added in Zoho CRM that I would like to link in Zoho creator.  When I add the Zoho CRM field it does not show the new module.  Is this possible?  Do i need to change something in CRM to make it accesible in Creator?
      • New User - Opening Stock Aging Report

        I am setting up new client and am entering Opening Stock - created items and entered quantity/price details. Now the aging report is showing all the opening stock as new. How do I enter the Purchase Dates of these items so that I get accurate Inventory
      • Bulk Receive Multiple Purchase Orders

        Is there a feature or function that will allow you to bulk receive issued purchase orders? I have about 100 that need to be received from 5 years ago.
      • Manual Invoice

        How to create a Manual invoice, I need to enter Amount directly instead of (qty*Rate). our company is a service sector
      • Effective Inbox Organization: Folders vs Tags in Zoho Mail?

        I'm exploring the best ways to organize a busy inbox, especially when managing multiple clients or project using Zoho Mail. I’d love to know what works best for others: 1. Do you prefer **folders** (possibly with sub-folders) for each client or project?
      • Merging contacts and or accounts

        Hello, In a prior CRM we were able to merge contacts and or accounts.  We have turned on the function to stop multiple contacts with the same email, so we can prevent multiple contacts from happening, however, we now have multiple contacts that have the
      • Capture Reason for absence next to Campaign Member Status. Is there a reasonable workaround?

        I've reviewed the topics I could find to do with this but still couldn't find anything that satisfies our requirements: We would like to track a *reason* (picklist or text, doesn't matter which) why a Campaign Member (Lead or Contact associated with a
      • Zoho Learning Management System - Certificate Upload by Employees

        We are planning to enroll employees in courses which are hosted by coursera or similar sites. I want to share the links of those courses and also want employees to upload their completion certificate once they are done. Is this function possible in
      • Add RTL and Hebrew Support for Candidate Portal (and Other Zoho Recruit Portals)

        Dear Zoho Recruit Team, I hope you're doing well. We would like to request the ability to set the Candidate Portal to be Right-to-Left (RTL) and in Hebrew, similar to the existing functionality for the Career Site. Currently, when we set the Career Site
      • Next Page