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!


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











      Zoho Campaigns Resources


        • Desk Community Learning Series


        • Digest


        • Functions


        • Meetups


        • Kbase


        • Resources


        • Glossary


        • Desk Marketplace


        • MVP Corner


        • Word of the Day


        • Ask the Experts


          • 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

          Zoho CRM Plus Resources

            Zoho Books Resources


              Zoho Subscriptions Resources

                Zoho Projects Resources


                  Zoho Sprints Resources


                    Zoho Orchestly Resources


                      Zoho Creator Resources


                        Zoho WorkDrive Resources



                          Zoho CRM Resources

                          • CRM Community Learning Series

                            CRM Community Learning Series


                          • Tips

                            Tips

                          • Functions

                            Functions

                          • Meetups

                            Meetups

                          • Kbase

                            Kbase

                          • Resources

                            Resources

                          • Digest

                            Digest

                          • CRM Marketplace

                            CRM Marketplace

                          • MVP Corner

                            MVP Corner




                            Zoho Writer Writer

                            Get Started. Write Away!

                            Writer is a powerful online word processor, designed for collaborative work.

                              Zoho CRM コンテンツ








                                ご検討中の方

                                  • Recent Topics

                                  • 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
                                  • Writing on sketch cards is bugged when zoomed in

                                    When zoomed in, it writes a noticeable distance above or to the side of where you're actually trying to write. The further you're zoomed in, the more noticeable it is. Zooming is also entirely absent on the desktop version.
                                  • Swipe between notes on iPhone

                                    It'd be convenient if I could move from one note to the next in a notebook simply by swiping left to right.
                                  • Sales IQ chat is not working in signed android apk

                                    I have integrated ZOHO sales IQ support chat and i have followed each step and its working fine in my development build but when i create signed APK for it. Chat does not work in it and showing awaiting for detail. I previously asked the same query but
                                  • COQL order by COUNT not working

                                    Dear community, I am trying to get a list of deal amounts per planner working on it and sorted to get see who has the least amount of deals. For some reason, I am unable to use sort by in combination with a COUNT. My original code was: query = "select
                                  • I want to duplicate a report and name it something else

                                    Hi, I have created a report, and now want to reproduce it and call it something else. so that I will end up with TWO separate reports with different titles. Please tell me how do I copy / reproduce a report please
                                  • Zoho CRM: Sales Rep Professional Certification Program on Coursera

                                    We are happy to share that we have published the Zoho Sales Representative Professional Certificate in partnership with Coursera, a leading platform for online learning and career development that offers access to courses and degrees from leading universities
                                  • OS X Notebook quits immediately upon launch

                                    NoteBook for OS X (Sequoia, but also under Sonoma) always quits immediately upon launch (so I cannot use the "Attach user log" option). I've restarted my MacBook but the problem persists. If it helps, attached is a diagnostic report from Library>Log
                                  • Can External users upload files or images to WorkDrive?

                                    I want to know if it is possible for someone externally through a link and PW be able to upload files and images onto WorkDrive?
                                  • Multi-line fields character limits

                                    Is there a way to set the character limit higher on multi-line fields so that we are not losing information pasted into the field? When the text is entered or pasted, there is no error to say that the text is too large. After saving and going back to view most of the text is gone.   Also, when viewing the resume, the text is not wrapped in the multi line fields and can t be read without scrolling across the page.
                                  • Taz bot not working — What should I do to resolve this issue?

                                    I am experiencing issues with the Taz bot in Zoho Cliq—not receiving responses or it does not seem to work as expected. Could you please explain why the Taz bot might not be functioning and what steps I should take to resolve this issue? Thank you!
                                  • Zoho Calendar soft bounce on @hotmail.com and @yahoo.com email addresses

                                    Hello, our Zoho calendar recently does not send the calendar invites to emails with hotmail and yahoo domains and comes back with a "soft bounce". other domains like Gmail works fine. Also sending "email" to the same emails to the above domains work well
                                  • OneNote Migration

                                    I am trying to migrate two notebooks from OneNote. For five days now I have had no notification that migration has completed and the migration page show 50% complete - one notebook completed one not finished. It just stays like this. I am unable to cancel
                                  • Set various time slot reminders for task and event

                                    Hi I would like known if there is possibility to set various time reminders for a task or event like we have the possibility to do in google calendar or google task. For example I'am creating an event or task and I want to be alerted before 30min and
                                  • is it possible to add more than one Whatsapp Phone Number to be integrated to Zoho CRM?

                                    so I have successfully added one Whatsapp number like this from this User Interface it seems I can't add a new Whatsapp Number. I need to add a new Whatsapp Number so I can control the lead assignment if a chat sent to Whatsapp Phone Number 1 then assign
                                  • Zoho Calendar not functioning---cannot edit, add attendees, etc.

                                    Hello, My calendar is acting strange. I'm using Chrome as my browser and pop ups are not blocked (the calendar worked fine yesterday). When creating an event, I'm not able to "edit" the event and add attendees, etc. The link is non-responsive. I cannot
                                  • Spilt Axis for stacked column and line graph

                                    Each month around this time I prepare a business review deck. One of the biggest annoyances I have with Zoho, also happens to be something that most other platforms have provided for a long time now, and that is being able to create a chart with stacked
                                  • Pin a note on top

                                    Dear Zoho Notebook Team, Please highly consider adding ability to pin a note on top and arrange pinned notes. I have a lot of notes that I want to pin important ones on top and this feature is missing badly. Thank you.
                                  • Windows 11 app ver 2.2.8

                                    I have been trialing Zoho Notes syncing between my PC and iphone. No problems with iphone but the Windows 64 bit app ver 2.2.8 was very buggy and would lock up completely, needing a Control Alt Delete etc to close it down. It seemed to be connected to
                                  • Deluge Script: Onboarding → Access Form

                                    Hello everyone, Edit: Sorry, I think I put this topic in the wrong section. I’ve recently run into an issue that’s been giving me a bit of a headache for the past few weeks. Context: This is my first time using Deluge to create a script, but it’s not
                                  • ZOHO BOOKS - EXCESSIVELY SLOW TODAY

                                    Dear Zoho Books This is not the first time but it seems to be 3 times per week now that the system is extremely slow. I work on Zoho Books 95% of my day so this is very frustrating. Zoho you need to do something about this. I have had my IT guy check
                                  • Windows Device Authentication

                                    We have recently started using ManageEngine, and my boss saw a device management feature in the Zoho One directory. We thought it would either help give us more intergration into Zoho one through bringing ManageEngine services through Zoho one. Or, it
                                  • How can I change spell check language?

                                    I cannot find the way to change spell check language. My "display language" is English, and I want to have the same one for Spell Check, but it is Russian!!! How can I change it? In one of your explanations you mentioned that I have to choose it from
                                  • Mail is so slow - doesn't even work!

                                    Mail has been getting slower and slower - and today it's not even pulling up emails in either Inbox or Unread. This is beyond frustrating since email is a big part of business. Sent a request through the useless help portal - no response. Called the useless
                                  • User marked as SPAMMER. Mail Fetch has also been disabled for any active POP accounts.

                                    I am the administrator for joelles.com One of our accounts has been blocked saying this: User marked as SPAMMER. Mail Fetch has also been disabled for any active POP accounts. I cannot change the disabled account in the control panel as it says that it
                                  • My domain did not activate

                                    Hi, my domain (apsaindustrial.com.ar) did not activate, and the phone verification message never arrived. Please would you solve this problem? Thanks.
                                  • ME SALE ESTE ERROR: No fue posible enviar el mensaje;Motivo:554 5.1.8 Email Outgoing Blocked

                                    Ayuda!! Me sale este error al intentar enviar mensajes desde mi correo electronico de Zoho! Tampoco recibo correos pues cuando me envia rebotan. Ayuda, Me urge enviar unos correo importantes!! Quedo atenta MAGDA HERNANDEZ +5731120888408
                                  • Is there a way to sync Tags between CRM and Campaigns/Marketing Hub?

                                    I wonder if there is a way to synch the tags between CRM and Marketing-Hub / Campaigns?
                                  • how to see if a specific contact opened an email in zoho campaign?

                                    how to see if a specific contact opened an email in zoho campaign?
                                  • Rich Text For Notes in Zoho CRM

                                    Hello everyone, As you know, notes are essential for recording information and ensuring smooth communication across your records. With our latest update, you can now use Rich Text formatting to organize and structure your notes more efficiently. By using
                                  • Revenue Management: #8 Revenue Recognition in Educational & Training Institutions

                                    Educational Institutions and training centres typically collect course fees at the time of enrolment, sometimes for a one-day workshop and sometimes for a year-long certification course. You might also charge separately for course materials or evaluation.
                                  • How to Customize Task Creation to Send a Custom Alert Using JavaScript in Zoho CRM?

                                    Hello Zoho CRM Community, I’m looking to customize Zoho CRM to send a custom alert whenever a task is created. I understand that Zoho CRM supports client scripts using JavaScript, and I would like to leverage this feature to implement the alert functionality.
                                  • how to use validation rules in subform

                                    Is it possible to use validation rules for subforms? I tried the following code: entityMap = crmAPIRequest.toMap().get("record"); sum = 0; direct_billing = entityMap.get("direct_billing_details"); response = Map(); for each i in direct_billing { if(i.get("type")
                                  • Using files from Zoho CRM in Gemini/ChatGPT/Claude

                                    Hi all, I’ve got subscriptions to Gemini and a few other AI tools which I use for tasks like data enrichment, email composition, etc. In our workflow, we often receive various documents from clients — such as process workflows, BRDs/requirement documents
                                  • Enhancements to the formula field in Zoho CRM: Auto-refresh formulas with the "Now" function, stop formula executions based on criteria, and include formulas within formulas

                                    Dear Customers, We hope you're well! By their nature, modern businesses rely every day on computations, whether it's to calculate the price of a product, assess ROI, evaluate the lifetime value of a customer, or even determine the age of a record. With
                                  • Maximum file limit in zoho people LMS

                                    Dear Team, I am having approximately 4.9 GB of material, including PPTs and videos for uploading in zoho people LMS course. May I know what is the maximum limit limit for the course files Thanking you, With regards, Logeswar V Executive _ Operations
                                  • Displaying related quotes in sales order and back

                                    Hi, My colleague liked to see to which sales orders, the quote has been converted. Quote shows Invoices, but not SO. Same, they would like to see the quotes in the sales order, as they can see invoices, packages, shipment, How can we achieve this ? Thank
                                  • automations: Can I execute a step on a specific date?

                                    I have created a form in Zoho forms, and created a contacts list. I have also begun setting up an automation with the intention of sending the form to the contact list on a specific date every month (via email) for the entire year (essentially sending
                                  • Next Page