Kaizen #105 - Functions, Integration Tasks, and API Credits - Part 1

Kaizen #105 - Functions, Integration Tasks, and API Credits - Part 1

Hello everyone!
Welcome back to another week of Kaizen!
In today's post, we will discuss functions, integration tasks, how they consume API and function credits.
In the next post, we will discuss connections, the difference between integration tasks and invoke URL in functions, how authentication happens for invoke URLs, and their credit consumption pattern.

What are functions in CRM?

A business involves multiple processes that cater to specific needs, like managing the sales pipeline, automating the flow of data between modules or different third-party systems, etc.
Zoho CRM gives you a wide range of options to achieve your business goals in the form of pre-defined functions under Setup > Developer Space > Functions. You can tweak these functions and associate them to workflows, blueprints, approval processes, circuits amongst many others, at just the click of a button.

While it is understandable that every business' needs are different, and the pre-defined functions, albeit very generic and most-commonly used, may not suit every business, Zoho CRM allows you to write your own functions specific to your needs.
More details on functions, here.
You can use Zoho's Deluge scripting language to write your own functions in a simple drag-and-drop function editor under Setup > Developer Space > Functions.

Integration tasks

We talked about how functions solve your business cases. How exactly do they do it?

Let's say you want to create a record in Zoho CRM using Functions. Instead of having to add values to every field the traditional way in web UI, functions have integration tasks that make working with records a lot easier as they act as API wrappers. These integration tasks help you make direct API calls without having to write code manually to handle API endpoints, HTTP methods, request parameters, or authentication mechanisms. What's more? They accept the input as function arguments in key-value pairs, much like JSON.

How are integration tasks beneficial to you?

When you use multiple Zoho products, data flow between them becomes much simpler and easier through integration tasks.
Your code becomes concise and easy to interpret.
As the integration tasks are essentially API wrappers, you do not have to worry about authorization as these integration tasks are considered as API calls triggered by the org's admin.

For today's post, let us discuss the function Converting a Sales Order to a Purchase Order, that uses integration tasks.
A gist of the code:
  1. Use the getRecordById integration tasks to get the ID of the Sales Order you want to convert to a Purchase Order
  2. Get the details of the product line items in the sales order, iterate through each of them, and add them to a map.
  3. Put these in another map to be used in the Purchase Order.
  4. Use the createRecord integration task and pass the new map to create a purchase order with the details from the sales order.

Here is the code:
Note that this function takes the soID(sales order ID) as the argument.

respMap = zoho.crm.getRecordById("Sales_Orders",input.soId.toLong());
productDet = ifnull(respMap.get("Product_Details"),"");
pdlist = List();
for each eachProd in productDet
{
productvalue = eachProd.get("product");
proid = productvalue.get("id");
proname = productvalue.get("name");
mp = Map();
mp.put("product",{"name":proname,"id":proid});
mp.put("quantity",ifnull(eachProd.get("quantity"),"0").toLong());
mp.put("list_price",ifnull(eachProd.get("list_price"),"0.0").toDecimal());
mp.put("discount",ifnull(eachProd.get("discount"),"0.0").toDecimal());
mp.put("total",ifnull(eachProd.get("total"),"0.0").toDecimal());
mp.put("net_total",ifnull(eachProd.get("net_total"),"0.0").toDecimal());
pdlist.add(mp);
}
paramap = Map();
paramap.put("Product_Details",pdlist);
paramap.put("Subject",ifnull(respMap.get("Subject"),""));
paramap.put("Contact_Name",ifnull(respMap.get("Contact_Name"),"").get("id"));
paramap.put("Account_Name",ifnull(respMap.get("Account_Name"),"").get("id"));
paramap.put("Owner",ifnull(respMap.get("Owner"),"").get("id"));
paramap.put("Sales_Order",ifnull(respMap.get("id"),""));
paramap.put("Terms_and_Conditions",ifnull(respMap.get("Terms_and_Conditions"),""));
paramap.put("Description",ifnull(respMap.get("Description"),""));
paramap.put("Adjustment",ifnull(respMap.get("Adjustment"),"0.0").toDecimal());
paramap.put("Discount",ifnull(respMap.get("Discount"),"0.0").toDecimal());
paramap.put("Tax",ifnull(respMap.get("Tax"),"0.0").toDecimal());
paramap.put("Shipping_Cuty",ifnull(respMap.get("Shipping_Cuty"),""));
paramap.put("Shipping_Code",ifnull(respMap.get("Shipping_Code"),""));
paramap.put("Shipping_Method",ifnull(respMap.get("Shipping_Method"),""));
paramap.put("Shipping_State",ifnull(respMap.get("Shipping_State"),""));
paramap.put("Shipping_Street",ifnull(respMap.get("Shipping_Street"),""));
paramap.put("Status",ifnull(respMap.get("Status"),""));
createResp = zoho.crm.createRecord("Purchase_Orders",paramap);
info paramap;
info createResp;


Here is the response:


This is the Purchase order created from the sales order.



I have associated this function to a workflow that converts a sales order to a purchase order, every time a sales order is created or updated.


How is authentication handled for integration tasks?

Functions with integration tasks are triggered by actions like workflows, blueprints etc. These triggers are org-wide and not restricted to specific sets of users. So, the integration tasks are executed as if the actions are done by the org’s admin.

API and Function Credits

Just like how APIs consume credits, integration tasks consume API credits, too.
The number of credits depends on the integration task you have used. For example, if you use the createRecord integration task, it consumes the same credits as the create records API. Similarly, the getRecordById integration task consumes the same credits as the Get Records API.
This is in addition to the function credits.
So, for the above function, the following are the various limits applied:
  • API credits - 2 - one each for getRecordById and createRecords integration tasks.
  • Function credits - 1

Where can you find the usage stats?


API Dashboard

Apart from API credit consumption, the API dashboard also gives you the details of the credits consumed by integration tasks.
The "Credits Usage" section shows you the credits specific to integration tasks. As you can see, out of the total available 56000 credits, 36 credits are consumed. Out of these 36 credits, 32 are from integration tasks.


The "Credits by Applications/Functions" pie chart gives you the credit consumption by each function or app.


When you click on one of them, you will see the details.


Functions Dashboard

The "Most Credits Consumed Functions" chart gives you the details of the functions that have consumed credits higher than most.


We hope you found this post useful. Next week, we will discuss Connections, invoke URLs and more.
Let us know what you think in the comments, or drop us an email 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
    • Recent Topics

    • How to upload own video?

      How can you upload your own video on your zoho website? I do not want to use another host, but i want to insert my own files. how can i do this?
    • Searching customer field

      Hello, When entering a receipt, we select customer information. The customer information is synced with Zoho CRM. However, we can't find the customer information because it searches for words that begin with the entered value. It needs to search for words
    • Introducing Version-3 APIs - Explore New APIs & Enhancements

      Happy to announce the release of Version 3 (V3) APIs with an easy to use interface, new APIs, and more examples to help you understand and access the APIs better. V3 APIs can be accessed through our new link, where you can explore our complete documentation,
    • Rotate an Image in Workdrive Image Editor

      I don't know if I'm just missing something, but my team needs a way to rotate images in Workdrive and save them at that new orientation. For example one of our ground crew members will take photos of job sites vertically (9:16) on his phone and upload
    • Improved RingCentral Integration

      We’d like to request an enhancement to the current RingCentral integration with Zoho. RingCentral now automatically generates call transcripts and AI-based call summaries (AI Notes) for each call, which are extremely helpful for support and sales teams.
    • Resume Harvester: New Enhancements for Faster Sourcing

      We’re excited to share a set of enhancements to Resume Harvester that make sourcing faster and more flexible. These updates help you cut down on repetitive steps, manage auto searches more efficiently, and review candidate profiles with ease. Why we built
    • Using Zoho Flow to create sales orders from won deal in Zoho CRM

      Hi there, We are using Zoho Flow to create sales orders automatically when a deal is won in Zoho CRM. However, the sales order requires "Product Details" to be passed in "jsonobject", and is resulting in this error: Zoho CRM says "Invalid input for invalid
    • WIDGET in related record list ZOHO CRM; how to get and put data to subform custom fields?

      he need: Read and write two custom subform line-item fields on Quotes: Segment_wyceny (picklist/text) and W_pakiecie (number). Write works; read does not return these fields via SDK. Environment Zoho CRM Widget Zoho Embedded App SDK v1.2 Module: Quotes
    • Cliq iOS can't see shared screen

      Hello, I had this morning a video call with a colleague. She is using Cliq Desktop MacOS and wanted to share her screen with me. I'm on iPad. I noticed, while she shared her screen, I could only see her video, but not the shared screen... Does Cliq iOS is able to display shared screen, or is it somewhere else to be found ? Regards
    • Zoho CRM Tracking Google Enhanced Conversions

      Can anyone @Zoho, consultants, or users help me understand if Zoho CRM is going to support Google's Enhanced Conversions? I included some information from Google below about it. We use Google Adwords for our pay per click advertising for lead generation,
    • zoho click, and nord VPN

      Unfortunately, we've been having problems with Zoho Click, where essentially the line cuts off after about a minute's worth of conversation every time we are on VPN. Is there a way we can change this within the settings so it does not cut the line off
    • Recurring Supervisor Rule Reminders for Open/In-Progress Tickets

      Hello Zoho Support Team, I would like to suggest a potential improvement regarding reminders for tickets and activities in Zoho Desk. Currently, it is possible to set reminders only once. In the Supervisor Rules section, it is possible to configure reminders
    • Connecting Portals from different Zoho apps

      Hi, I note that Zoho has functionality for customer portals for several of the Zoho apps, like CRM, Projects, Desk etc. Is there any way to connect these portals?  It would be great if we could give our customers access to a portal in which they could
    • Billing Management: #5 Usage Billing

      After understanding the nuances of Advance Billing and Retainers, we will explore one of the booming billing models. Long ago, villagers drew water from a shared well in a small village. The well was a lifeline for the entire community. Ravi, the well
    • Function #10: Update item prices automatically based on the last transaction created

      In businesses, item prices are not always fixed and can fluctuate due to various factors. If you find yourself manually adjusting the item rates every time they change, we have the ideal time-saving solution for you. In today's post, we bring you custom
    • Inventory Adjustments

      Hi, How to transfer the material from one head to another ? Like materials purchased for manufacturing the laptop need to transfer from consumption inventory (Quantity of raw materials reduced) to destination inventory ( Quantity of Laptop increased)
    • Zoho CRM Community Digest - Aug 2025 | Part 1

      Hey everyone! The first half of August went by, and we have a few announcements and some good noteworthy discussions. So, let's take a look at them! Product Updates: Introducing Connected Records feature: Zoho CRM’s Next-Gen UI now includes Connected
    • Problems with email templates (HTML - Outlook)

      Hi there, I've been trying to create a newsletter from the template "Business 4". Everything looks great in the preview, but when I send it to my Outlook inbox, the layout doesn't seems to stick. More particularly: - The line-height is way more reduced, even though I used the line-height tool from the template - Columns but they are sometimes misaligned - Font size is not always the one I've selected. Could you help? Thanks!
    • Please make it easier to Pause syncing

      right now it takes 3 clicks to get there. sounds silly, but can you make it just 2 clicks to get it done instead? thats how dropbox does it, 2 clicks to pause instead of 3.
    • How to create a Zoho CRM report with 2 child modules

      Hi all, Is it possible to create a Zoho CRM report or chart with 2 child modules? After I add the first child module, the + button only adds another parent module. It won't let me add multiple child modules at once. We don't have Zoho Analytics and would
    • Create static subforms in Zoho CRM: streamline data entry with pre-defined values

      Last modified on (9 July, 2025): This feature was available in early access and is currently being rolled out to customers in phases. Currently available for users in the the AU, CA, and SA DCs. It will be enabled for the remaining DCs in the next couple
    • SalesIQとPageSenseの利用について

      初めての投稿で場違いだったらすいません。 弊社ではSalesIQを運用しているのですが、追加でPageSenseの導入もしたいと現場からの声があります。 両サービスともクッキー同意バナーが必要なサービスなのですが 弊社では同意無しに情報はとりませんという方針なので 2つ入れると2つバナーを出す必要がでてきます・・・ 両サービスを運用されてる方があれば運用状況とか教えてほしいです。 PageSenseについては詳細まで機能を理解してないなかでの質問です。
    • How to integrate Zoho Forms with Zoho CRM on Standard Plan

      Hello Zoho Support Team, I am using the Standard Zoho Forms plan (USD 30/user) and I would like to integrate Zoho Forms with Zoho CRM so that certain fields in my forms can be automatically prefilled using data from Deals in CRM. Specifically, I want
    • CRM : Function to add user name to text field

      I have a lookup field in a module that is linked to the CRM users so we can assign a Project Lead to the customer. Sadly Zoho Marketing Automation doesn't sync Lookup fields so I need to extract information from the lookup to text fields: Lookup field
    • Export PDF File Name

      Is it possible to change the default Zoho .pdf naming scheme for inventory items like quotations? Would like to use the the Subject as the default quote name. Is this possible?
    • How to change the from address from 'no reply' for an email template in CRM

      Hi, We have our CRM set up with the from field as sales@XXX. I have just created a series of email templates and sent a test and they are sending from noreply@zoho I have tried searching for how to change the email template but don't have the options
    • Zoho CRM Client Script - SetCriteria in lookup Field

      Hello All One More Zoho CRM Client Script Tips & Trick. Now you can Set the Criteria on Your lookup in zoho CRM, It Comes With a Create Page, Edit Page, and Details Page (Standard). Example:- We have a Room Module that includes Room Name, Status, Campus,
    • Kaizen #71 - Client Script ZDKs for Detail (Canvas) Page

      Hello everyone! Welcome back to another interesting Kaizen post. In this post, we can discuss Client Script ZDKs support for Detail (Canvas) Page. What is Detail (Canvas) Page? A Detail(Canvas) Page allows you to customize the record detail page to your
    • 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")
    • Add Custom Reports To Dashboard or Home Tab

      Hi there, I think it would be great to be able to add our custom reports to the Home Tab or Dashboards. Thanks! Chad
    • Rich-text fields in Zoho CRM

      Hello everyone, We're thrilled to announce an important enhancement that will significantly enhance the readability and formatting capabilities of your information: rich text options for multi-line fields. With this update, you can now enjoy a more versatile
    • Create Lead Button in Zoho CRM Dashboard

      Right now to create Leads in the CRM our team is going into the Lead module, selecting the "Create Lead" button, then building out the lead. Is there anyway to add the "Create Lead" button or some sort of short cut to the Zoho CRM Dashboard to cut out
    • Zoho Reports Duplicating Entries

      I have a custom costing tab with a table where we entre invoices. These are under a Heading (PO Subject) and notes added in the form with different line items. In the reports, I have organised the report to group per PO Subject, with the total of the
    • Validation Rule Not Working for Mandatory Field in Zoho Blueprint

      As a Zoho user, we created a validation rule for a specific field. However, we noticed that when we made the same field mandatory within a Blueprint, the validation rule we defined did not work. When we reported this issue to Zoho Support, they stated
    • Notes Issues

      Been having issues with Notes in the CRM. Yesterday it wasn't showing the notes, but it got resolved after a few minutes., Now I have been having a hard time saving notes the whole day. Notes can't be saved by the save button. it's grayed out or not grayed
    • Export from Contacts module to Products module in Zoho CRM

      Good afternoon, I would like to send a number of contact info from the Contacts module into the customized module (tickets to an event) in one operation. I have selected several contacts in the Contact module (people who I have labelled as people I want
    • Zoho Commerce

      Hi, I have zoho one and use Zoho Books. I am very interested in Zoho Commerce , especially with how all is integrated but have a question. I do not want my store to show prices for customers that are not log in. Is there a way to hide the prices if not
    • Can’t receive emailI c

      I have generated a basic for but when I submit it I don’t get a email, I’ve been in the settings and tested me email, all appears correct, can you please help me
    • Data Capture for Historical Activity (Especially One Lead Downloading Variois reports without Overwriting the info)

      Is there a better way in Zoho CRM to capture and archive a lead’s historical activity—specifically whenever they download reports—so that the data is stored without being overwritten?”
    • Client Script - Updating Field Value in Detail Page of a Lead

      Hello, I'm trying to use Client Script To enrich some data of the Lead when one of my User fill the "City" field in the detail page of the Lead. This is my Script: log (value); var response = ZDK.Apps.CRM.Functions.execute("getInfoCitta", { "nomeCitta":
    • Next Page