Kaizen# 83: Get input via pop-up and show/hide fields in Client Script
Hello everyone!
Welcome back to another Kaizen post.
In this post, let us discuss the following use cases.
A. How to get input via a pop-up
1. Requirement
Consider that the requirement is to display a pop-up whenever a Salesperson changes the "Stage" of the deal. The Salesperson should be able to add comments in that pop-up. This comment should be populated to the field "Description" along with the name of the "Stage" and it should keep appending the comments whenever there is a change in Stage.
Solution
The script should execute whenever the salesperson selects the field "Stage". So create a Client Script on Create Page of the Deals module.
- Go to Setup > Developer Space > Client Script. Click +New Script.
- Specify the details to create a script and click Next.
- Enter the following script and click Save.
var notes_pop_up = ZDK.Client.getInput([{ type: 'text', label: 'Comments' }], 'Deal', 'OK', 'Cancel'); var notes_field = ZDK.Page.getField("Description"); if (notes_field != null) { var desc = notes_field.getValue() + " " + value + "- " + notes_pop_up +","; notes_field.setValue(desc); } |
- The getInput() ZDK enables you to show a pop-up on screen. You can add fields with labels in this pop-up. The field that appears in this pop-up is a pseudo field and is not a real field in the Deals module. It will appear only when Client Script executes and you can use it in the script. Such pseudo fields are highly beneficial when you want to manipulate/calculate data based on user input as it does not affect the module's field limits of Zoho CRM.
Syntax of getInput() :
- getInput(options, heading, accept_message, reject_message) → {Object}
Parameters:
- options - Input options (Maximum number of options is 7).
- heading - Heading of the pop-up.
- accept_message - Text for accepting message.
- reject_message - Text for rejecting message.
Here is how the Client Script works,
B. How to hide and show fields using Client Script
1. Requirement
To hide the field "Expected Revenue" when the status of the Deal is "Needs Analysis".
Solution
This script should run whenever the salesperson updates the field "Stage". So create a Client Script on Edit Page of the Deals module.
- Go to Setup > Developer Space > Client Script.
- Click +New Script.
- Specify the details to create a script and click Next.
- Enter the following script and click Save.
var stage_field = ZDK.Page.getField('Stage').getValue(); log(stage_field); var field_obj = ZDK.Page.getField('Expected_Revenue'); if (stage_field == 'Needs Analysis') { field_obj.setVisibility(false); } else { field_obj.setVisibility(true); } |
Syntax
Parameters
- value - visibility attribute of the field input(true/false)
Here is how the Client Script works.
We hope you found this post useful. We will meet you next week with another interesting topic!
If you have any questions let us know in the comment section.
Click here for more details on Client Script in Zoho CRM.
Happy Scripting!
Related Links
Zoho Developer Community
Deliver unforgettable customer experiences
Deliver unforgettable customer experiences
New to Zoho Marketing Plus?
Everything you need to run your marketing
New to Zoho Marketing Plus?
Everything you need to run your marketing
Zoho Desk Resources
-
Desk Community Learning Series
-
-
-
-
-
-
-
-
-
Sticky Posts
Introducing Built-In Telephony in Zoho CRM
Dear All, Greetings! We are excited to introduce the bespoke "Built-In Telephony" in Zoho CRM. Built-in telephony is designed to allow organizations to build their own telephony framework, manage subscriptions and payments, generate call reports, and
Enhancements in Canvas
Dear All, Greetings! Canvas lets you design the record details page to suit your brand or business preferences. We are glad to introduce the following enhancements to uplift your design experience. Reusable Components Style Presets Let's go! Reusable
Stay in the Know: Important TRAI mandate on URL whitelisting for Indian CRM customers
Dear Customers, We hope you're well! If you are a CRM customer in India and have the Notification SMS feature enabled, this post is relevant to you. Notification SMS lets you send messages to your customers as an acknowledging response to transactions.
Announcing the deprecation of a few capabilities within Feeds
Dear Customers, We hope you're well! We are here with a recent update we made to the Feeds feature in Zoho CRM. We have deprecate the following capabilities from Feeds: View inactive/ dormant records View records followed by you Auto-follow records With
Effortlessly advance through your CRM blueprints by including optional fields in transitions
Editions: Professional edition and above DCs: All Release plan: This enhancement is being released in a phased manner to customers. It will soon be available to all users. [Updated on 5 Sep 2024] This enhancement has been released to all users in all
Zoho TeamInbox Resources
Zoho DataPrep Resources
Zoho CRM Plus Resources
Zoho Books Resources
Zoho Subscriptions Resources
Zoho Projects Resources
Zoho Sprints Resources
Qntrl Resources
Zoho Creator Resources
Zoho WorkDrive Resources
Zoho Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.