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

      • Enhanced data export features: XLSX format, custom character encoding, and selective record export

        Greetings all, Here are a few enhancements related to exporting CRM data, including the ability to export data in XLSX file format now. The Export feature under Data Administration now offers new options that expand its flexibility and enable users to
      • Tip #42 – How to manage data security with Privacy Settings – 'Insider Insights'

        Data privacy is a cornerstone of trust in remote support. Through Privacy Settings in Zoho Assist, you can set up how data is gathered, stored, and handled in your organization. These settings ensure compliance, data protection for sensitive details,
      • Zoho DataPrep and File Pattern configuration

        I'm using Zoho data prep to ingest data from One Drive into Zoho Analytics... The pipeline is super simple but I can't any way to get all the files that I need. Basically I need to bring all the files with a certain pattern and for that I'm using a regex
      • Introducing Dark Mode / Light Mode : A New Look For Your CRM

        Hello Users, We are excited to announce a highly anticipated feature - the launch of Day, Night and Auto Mode implementation in Zoho CRM's NextGen user interface! This feature is designed to provide a visually appealing and comfortable experience for
      • Quick Item Search & Auto-suggestion for Invoices

        Hi Team, I am facing an issue while creating invoices in Zoho Books. Currently, I have to type the full item name in the correct sequence and spelling for it to appear. For example, my item name is: "Distemper Acri Silk Special White 10kg" If I type something
      • Empowered Custom Views: Cross-Module Criteria Now Supported in Zoho CRM

        Hello everyone, We’re excited to introduce cross-module criteria support in custom views! Custom views provide personalized perspectives on your data and that you can save for future use. You can share these views with all users or specific individuals
      • Ticketbai! en el Pais Vasco

        Hola a todos, En enero de 2.022 se va a implantar en el país vasco un nuevo sistema de facturación, denominado ticketbai!, ¿hay alguna previsión de realizar las adaptaciones en zoho books o zoho invoices? Ignoro la cantidad de clientes que tienen estas
      • Zoho CRM mobile app feature update: home page widgets, field tooltips and user image upload

        Hello everyone! Your business doesn't pause when you're on the move, and neither should your CRM. That's why in our latest update, we've introduced a few new features to make your mobile CRM experience smoother and more efficient. Let's take a quick look
      • Zoho CRM Plain Text Template: Line Breaks and Formatting Issue

        Hello, I'm following the instructions to create email templates in Zoho CRM, but I'm having a problem with the plain text version. https://help.zoho.com/portal/en/kb/zoho-sign/integrations/zoho-apps/zoho-crm/articles/zoho-crm-email-templates#Steps_to_create_a_custom_email_template
      • Optimizing Task Handling: Auto-Remove Recurrence for cancelled Tasks.

        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:
      • Important updates to your connectors

        Hello everyone, Greeting from Zoho Creator! We're excited to announce that we'll be rolling out significant backend updates to Zoho Creator's built-in connectors to enhance security by following the latest frameworks. The existing version of some of the
      • Create, collaborate, and manage agreements with Zoho Sign

        Agreements drive business. We launched Zoho Sign in 2017 as a simple digital signature tool to sign agreements from anywhere, at any time. Over the years, we've learned that most agreements go through last-minute changes before they're signed. Our users
      • Function #25: Automatically generate purchase orders from a sales order

        We kicked off the "Function Fridays" series with the goal of helping you automate your everyday accounting tasks. As we delve into today's post, I'm delighted to announce that we're here to present the 25th custom function in this series. While it is
      • Has Anyone successfully integrated Zoho and Sage Intact?

        Hey all, We’re evaluating Zoho One + Sage Intacct and I’m trying to connect with anyone who has actually implemented the two together.Specifically, I’d love to know: -- Which functions you kept in Zoho vs. Intacct (e.g., Product Catalog, AR/AP, invoicing,
      • 5名限定 課題解決型ワークショップイベント Zoho ワークアウト開催のお知らせ (9/25)

        ユーザーの皆さま、こんにちは。Zoho ユーザーコミュニティチームの藤澤です。 9月開催のZoho ワークアウトについてお知らせします。 今回はZoomにて、オンライン開催します。 ▷▷参加登録はこちら:https://us02web.zoom.us/meeting/register/6OSF2Bh6TumsMIlDwaY_PQ ━━━━━━━━━━━━━━━━━━━━━━━━ Zoho ワークアウトとは? Zoho ユーザー同士で交流しながら、サービスに関する疑問や不明点の解消を目的とした「Zoho
      • hiding a topic from all but one segment (or list)

        My organization sends out a number of newsletters using Zoho Campaigns. One of those newsletters is for volunteers. In order to become a volunteer, a person has to first go through our volunteer orientation (training). After that, they can receive newsletters
      • How do I set up this automation correctly?

        When contacts enter my Subscribers list, I want it to reference a custom field to see if it is empty. Then I want it to do two things: If empty: Assign a tag based on a different custom field. If that custom field is empty, assign a different tag. If
      • Custom confirmation message

        How can I change the message that users see after they submit the booking form? I have to confirm some details before their appointment is officially "confirmed", so I want to change it where it doesn't say their appointment is "confirmed" but rather
      • Has anyone integrated SMS well for Zoho Desk?

        Our company does property management and needs to be able to handle inbound sms messages which create a ticket for Zoho Desk. We then need to be able to reply back from Zoho desk which sends the user an sms message. This seems like a fairly common thing
      • Desk x CRM Integration

        Howdy! We currently use SalesIQ but we are considering moving across to Desk as it seems to have more functionality that we want. One of the pulls is the ability for our customers to self serve. But, I might be getting over excited and not actually need
      • Issue with Save & Share Link – Works for Others but Not Creator

        I’ve enabled the "Save and Share" feature in Zoho Forms, and it works correctly for all users accessing the public link—except for me (the form creator). Issue Details: When I save and share the link, recipients see a “no permission” error. The form is
      • Save the pdf report from a registration form in a Folder

        Through Zoho Forms I created a registration form with quite a lot of rules to handle different variables (TEAM types, payment in installments, etc.), and the result is pretty good. The automatic PDF that is sent to the respondent upon submission is already
      • zoho forms integration to zoho work drive

        Scenario: A user fills out a Zoho Form, entering details such as email, mobile number, and other required information, and uploads supporting documents like PAN, Aadhaar, etc. Upon submission, the data is available in Zoho Forms Reports. Requirement:
      • Zoho Forms to Zoho CRM Integration failed - can I restart it?

        The integration of Zoho Form to Zoho CRM has failed. Is there a way for me to restart it for the impacted entry?
      • insert an equation, but in document, it shows an image not available.

        I'm new to Zoho writer and used Zoho writer in desktop app version . When I inserted an equation, I got an image not available sign. Any help is appreciated. Thanks, Charles
      • Zoho Desk Android app update - Swipe action customization

        Hello everyone! We have brought in support for the swipe action customization in latest version(v2.9.13) of the Zoho Desk Android app update, enabling you to configure left and right swipe gestures on tickets to carry out the actions swiftly without opening
      • Import KB template OR Export template for zoho desk?

        Greetings. Can you tell me if there is a way to get an EXPORT of my KB articles? OR is there a template you supply for importing KB articles into my zoho desk? I am looking for a method of understanding what fields can be imported, and what their possible
      • XML format to import knowledgebase into Zoho Desk

        Hi, We just started to use Zoho Desk and want to import our knowledgebase from our old support system (Freshdesk) to Zoho Desk. Can anyone give us information about the format of xml file to import? There is no explanation on the related page.
      • Zoho Desk integration with Power BI

        Hi, I want to be able to create a Power BI report which has live updates of ticket data from zoho desk, is this possile at all? Thanks Jack
      • Arranging Ticket Templates

        Is there any way to arrange our ticket templates? It doesn't look very organised when it's just arranged according to when they were created. We want the list to look more organised, by arranging/grouping them by topics, or even just by alphabetical
      • New Mandatory One-Click Unsubscribe Link Overshadowing Custom Unsubscribe Link

        I was recently informed by Zoho CRM Support that they are now mandated by the large email service providers like Google and Yahoo to provide a one-click unsubscribe option in the header (not the body) of all mass emails. I have a custom unsubscribe link
      • What they mean with "Portal"?

        I just downloaded this app to take my personal notes on digital art studio because it seemed to me the most comfortable app to do it, I use it very often, what do they mean by “no activity on your portal”? I have about 1 year of work here and I don't
      • Inactive User Auto Response

        We use Zoho One, and we have a couple employees that are no longer with us, but people are still attempting to email them. I'd like an autoresponder to let them no the person is no longer here, and how they can reach us going forward. I saw a similar
      • favorites no longer listed

        Hello, I can no longer navigate to my Favorites from the pulldown at the top of my grid view (see attached screenshot). I wasn't able to find it anywhere! Please help me display my Favorites. Thank you!
      • Notecards Disappeared

        Got a new phone. Downloaded and signed in Zoho Notebook. Not finding the Note cards. Just Empty Note books. Frustrating.
      • Table Errors

        Hello, I'm new to Zoho Notebook and using it on several Mac/Apple devices. My question is regarding tables: Why do they become broken, and how to fix the error without retyping all my data? (Please see the screenshot attached.)
      • Aggregating the First Value in the Group By of a dataset

        Hi I am trying to get the following Aggregate Formula to work in my chart, but cannot seem to get the right format. I have a series of data that I am running an include_groupby and want to SUM only a column in the first row of each group. So for example.
      • Zoho Tables instead of Zoho Creator Spreadsheet reports <3

        That would make my day for sure. Zoho Creator is create, but miss data entering as AirTable/Spreadsheet can. Seeing Zoho putting effort in this makes me think maybe one day we could see a similar interface for Zoho Creator spreadsheet reports. B.
      • Zoho Sheet - Desktop App or Offline

        Since Zoho Docs is now available as a desktop app and offline, when is a realistic ETA for Sheet to have the same functionality?I am surprised this was not laucned at the same time as Docs.
      • Notebook Stack

        Hi Everyone I Hope you´re fine, I´m sorry if this idea was posted before (I made a search but I haven´t find anything related). So, Having the possibility of stacking notebooks would be an interesting way to order notebooks that correspond to the same
      • Next Page