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
Access your files securely from anywhere
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
Gain control over record sharing with portal users through our new enhancement: criteria-based data exposure
Dear Customers, We hope you're well! Portals is a self-service avenue through which your clients can access and manage their direct and related data in Zoho CRM. This empowers them to be more independent and enables them to experience a sense of transparency
Identify and prioritize profitable deals: Zoho CRM Forecasts help users focus on revenue-driving opportunities
Dear Customers, We hope you're well! At any given time, a sales rep handles multiple deals, each progressing at its own pace. But not all deals will succeed—some will take time, and others may never close. This varying momentum directly impacts the organization’s
Context and convenience just got better with Zia's email intelligence
Dear Customers, We hope you're well! We are in 2024, and email as a tool is only getting more powerful each day. While it enables seamless daily correspondences, we are here with a set of abilities that will enhance your user experience and save several
Investigate your losses using VoC's root-cause analysis
Dear Customers, We hope you're well! Loss and customer churn are inevitable in any business, even for historically successful ones. While it's never pleasant to see customers leave, it's crucial for businesses to identify the triggers behind these losses
Enrich your CRM data and keep them updated
You spend a lot of your time and efforts in generating quality leads for your business. While generating leads is a challenge in itself, the real deal begins when sales reps try to nurture these leads and convert them as customers. So how equipped is your sales team with information about your leads matters a lot. For example, you might be using webforms to generate leads and collect customer information from your website. The lesser your webform fields are, the more your sign-ups right? From optimizing
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 Campaigns Resources
Zoho CRM Resources
Zoho Show Resources
Writer Get Started. Write Away!
Writer is a powerful online word processor, designed for collaborative work.