Launch and Sync a Custom Widget in Flyout Mode Using Client Script in Zoho CRM
Summary:
This article explains how to launch a custom widget as a
flyout in Zoho CRM using
Client Script, pass data from a CRM field to the
widget, and update the same field based on the widget’s response.
Requirement Overview:
Certain use cases require custom interactions when a user edits a field in Zoho CRM.9 For example, launching a calculator or custom logic interface without navigating away from the record. By using a Client Script with flyout configuration, you can open widgets in a dedicated pane (flyout), pass data from the CRM record, and update fields based on the widget’s output.
Deploy Client Script in Zoho CRM:
You will configure a Client Script to trigger when the user edits the Price field. The script will:
Open a Flyout widget
Send the field value to the widget
Wait for a response from the widget
Update the Price field with the returned value
Use Case
Scenario:
When a user edits the Price field, a calculator widget opens as a Flyout. The field’s value is passed to the widget for computation. Once a new value is calculated in the widget, it sends the result back to the Client Script, which then updates the same field in CRM.
Configuration:
Client Script – Create and Handle Flyout
Create a Client Script and run it on change of the Price field
-
Go to Setup → Developer Hub → Client Script.
-
Click New Script.
-
Select the appropriate Category and Event as shown in the screenshot (Event: On Change, Field: Price).
-
Add your script code in the editor.
-
Click Save and Publish/Activate the script.
Screenshot for reference:

Code:
const WIDGET_API_NAME = "Calculator";
// Step 1: Create and configure the flyout
ZDK.Client.createFlyout('myFlyout', {
header: WIDGET_API_NAME,
animation_type: 3,
height: '400px',
width: '420px',
top: 'center',
right: '0'
});
// Step 2: Open the flyout widget and pass the Price field value
ZDK.Client.getFlyout('myFlyout').open({ api_name: WIDGET_API_NAME, type: 'widget'});
let response = ZDK.Client.getFlyout('myFlyout').notify({ data: ZDK.Page.getField('Price').getValue() }, { wait: true });
// Step 3: Close the flyout after receiving response
ZDK.Client.getFlyout('myFlyout').close();
// Step 4: Update the Price field with the response
ZDK.Page.getField('Price').setValue(response.incrementedNumber);
In the widget code, register the following event listener to wait for the flyout and receive data from the client script.
ZOHO.embeddedApp.on("NotifyAndWait", function (data) {
console.log("Client Script synchronous flyout notification", data);
console.log("Data received:", data.data);
// Store the incoming data (e.g., original price)
result.value = data.data.data;
// Save the Flyout ID for sending the response back
FLYOUT_ID = data.id;
}
To send a response back from your widget to the Client Script, you can use the Zoho CRM JS SDK method:
ZDK.Client.sendResponse(FLYOUT_ID, {
incrementedNumber: result.value // Replace with actual computed result
});
In the widget UI, add a “Send Result” button that, on click, computes the value and calls the SDK method to return it to the Client Script.
Example Workflow :
User edits the Price field.
The Client Script opens the Calculator widget as a flyout.
The widget receives the original price and performs the calculation.
Upon clicking “Send,” the widget returns the computed value.
The Price field is updated automatically with the new value.
Working demo:
The
source code for the widget used in the example above is available
here.
Related Links
Custom Solution Created by Francis (Vishnu) | Zoho Partner Support