DEV Community

Skyfall
Skyfall

Posted on Edited on Originally published at skyfallhq.net

Zoho CRM custom buttons: Client Script, Deluge function or Invoke URL?

Disclosure: Skyfall Labs is an official Zoho Partner. This is a cross-post of our guide; the original, with sources, is at https://www.skyfallhq.net/resources/zoho-crm-custom-buttons-client-script-vs-deluge

Short answer: a custom button can run a Deluge function, open a URL built from record fields, or run a Client Script in the user's browser. Zoho describes Client Script as browser-side logic with a 10-second timeout, and function buttons as the way to run on-demand actions such as syncing a record to an external system. Which to use depends on whether the logic belongs to the screen or to the back end.

What a custom button is, per Zoho

Zoho's Custom Buttons help page lists these action types: from the gallery, from existing actions, writing a custom function (Deluge), Invoke a URL, and open a web tab. That page does not mention a Client Script action. Zoho's separate Client Script update post describes Client Script as an Action Type on the Buttons screen, so the pages were not written together; check the Buttons screen in your own org to see which types you have.

Per the help page, buttons can be placed in the list view (utility menu, each record row or mass action menu), inside a record (Create/Clone, Edit or Details pages), at the top of related lists, in wizards and after the Forward button on email threads. Kanban view does not support per-record buttons.

Source: Zoho Help: Creating Custom Buttons, Zoho Community: Client Script update, support for custom buttons

Comparison from Zoho's pages

Function (Deluge) Invoke a URL Client Script
Runs When a user clicks; the return value must be a string, shown in a modal Opens a URL in a new tab; URL can include merge fields (max 3,000 characters) In the browser; Zoho calls it JavaScript that runs on your web browser instead of the server
Typical use per Zoho On-demand actions such as generating a quote or syncing a record to an external system Opening a link built from record fields Confirmation prompts, multi-step flows, auto-filling fields, showing or hiding fields, making fields mandatory or read-only
Edition per Zoho Custom Buttons help page: Professional, Enterprise and Ultimate Same page Client Script overview: Professional, Enterprise and Ultimate; the profile needs Developer Permissions
Stated limits Zoho's function page states none specific to buttons and points to a separate limits page URL up to 3,000 characters 10-second execution timeout; a separate script for every layout; ZDK CRM API calls use API credits

Source: Zoho Help: Creating Custom Buttons, Zoho Developer: Associate Functions to Buttons, Zoho Developer: Client Script overview, Zoho Community: Client Script update, support for custom buttons

Client Script buttons: how they are set up

Zoho's update post gives these steps: Setup, Customization, Modules and Fields, choose the module, open Buttons, New Button, set Action Type to Client Script, choose position and layout, click Create under Configured Client Script, write the script, select the profiles that should see the button, and save. Zoho states the script is saved only after the button is saved. The event is onClick, and its context depends on where the button is placed. Zoho's events page lists a button event for standard and wizard pages and names onClick for canvas buttons; Zoho's update post gives onClick as the event for Client Script buttons.

Zoho's examples include a per-record add-notes button, a bulk-notes button for selected records, an import-products button on the Create page that reads from a Zoho Sheet, and a bulk email button in a related list. The post said mobile support would arrive in Q3 2025; we could not verify its current status, so check before relying on it.

Source: Zoho Developer: Client Script events, Zoho Community: Client Script update, support for custom buttons

Function buttons and Invoke URL: behaviours to know

  • A function returns an empty string by default, so alerts or pop-ups must be configured in the script.
  • Invoke a URL always opens a new tab; to run logic before opening a URL, Zoho points to the openUrl method inside a function.
  • In list view you must select at least one record. When several records are selected for a custom function their values are passed separated by |||.
  • List view utility-menu buttons cannot access record information when configuring actions.
  • Up to 50 custom buttons per module; button name up to 30 characters.
  • Only the Administrator can edit existing custom buttons; buttons are restricted by profile and can be shared with specific profiles and users.

Source: Zoho Help: Creating Custom Buttons, Zoho Developer: Associate Functions to Buttons

Choosing between them (advice)

  • Use Client Script when the job is about the screen the user is on: validating or pre-filling fields, asking for confirmation, hiding fields.
  • Use a Deluge function when the job touches other records or systems and should not depend on a browser, such as a sync or document generation.
  • Use Invoke a URL when you only need to open a page built from record data.
  • Remember Client Script needs a script per layout, so many layouts means more to maintain.
  • Keep a list of every button, who can see it and what it calls, and test changes in a sandbox first.

When to bring in help

Buttons that nobody remembers building, with scripts per layout and functions calling the API, are a common source of maintenance risk in an older Zoho org. A review that inventories buttons, scripts and the functions behind them, and decides what to keep, is part of Zoho CRM customization at Skyfall Labs. As an official Zoho Partner we have a commercial interest, so treat our view accordingly.

Frequently asked questions

What is a Client Script in Zoho CRM?

Zoho describes it as a piece of JavaScript that runs in your web browser instead of on the server, used to add business logic to CRM events such as clicking Save, changing a field or clicking a custom button.

Which editions include Client Script and custom buttons?

Zoho's Client Script overview lists Enterprise, Ultimate and Professional, and its Custom Buttons help page lists Professional, Enterprise and Ultimate. Confirm in your own org.

Is there a time limit on a Client Script?

Yes. Zoho states a 10-second execution timeout.

How many custom buttons can a module have?

Zoho's help page says up to 50 per module.

Do I need a separate Client Script for each layout?

Yes. Zoho says you need a separate Client Script for every layout of a module.

Can a button show a message after a function runs?

Only if you build it in. Zoho says a function returns an empty string by default, so alerts must be configured in the script, and the return value must be a string.

Sources

Need hands-on help? Skyfall Labs offers Zoho consulting, implementation and customization. Original guide: https://www.skyfallhq.net/resources/zoho-crm-custom-buttons-client-script-vs-deluge

Top comments (0)