Client Script: Confirmation Alert before Deleting Critical Data in Zoho CRM

Client Script: Confirmation Prompt Before Deleting Critical Data in Zoho CRM

Requirement Overview

A Zoho CRM user wants to have a Confirmation Alert to ensure having a double confirmation before Clearing data from the Sensitive & Critical fields.

Use-case

Bank which uses Zoho CRM to manage client interaction in an effective way. It also keep customer’s sensitive data such as Personal Information, Account Number, Credit Card number, Security numbers, etc. Protecting this data is not just a security best practice—it is also a regulatory requirement governed by financial laws and data protection standards like GDPR.

Users often update, modify, or clear data as part of routine operations. A single accidental action(i.e. such as clearing a field), could result in irreversible data loss.

To mitigate this risk, a Double Confirmation Mechanism is implemented via Client Scripts in the CRM interface. This enables to triggers a confirmation pop-up alert before executing any data-clearing action on sensitive fields.
Alert
Why It is Important:
  1. Data Protection 
  2. Compliance Assurance
  3. Mitigated Risk
  4. Accident Prevention
  5. Enhanced Confidence
Info

Permissions & Availability

-> Users with the Manage Extensibility can configure & setup Client Script.
-> Users with the Manage Sandbox permission can manage the sandbox and test this use-case.

Configuration

Now, let us create a Client Script on Edit Page of a Lead Module for a specific field(i.e. Credit Card Number). As an example, whenever the field modifies to Empty, script will throw a Pop-up to get Confirmation from end User before proceeding further.

Follow the steps below to configure the Client Script for this use case:

1) Provide the basic information, like Name and Description based on script purpose.

2) In the Category Details section, please choose the following:

Category as Module.
Page as Edit.
Module as Leads.
* Choose the required Layout.

3) In the Event Details section, please choose the following:

Type as a Field Event.
* Choose the required Field from the drop-down.
Event as onChange.

The Code

  1. //fetching record details and getting privious value of field(Credit Card Number)
  2. recDetails = $Page.record;
  3. creditCardPrevValu = recDetails.Credit_Card_Number;
  4. console.log(creditCardPrevValu);

  5. //fetching same field with current value(after making update)
  6. var currentField = ZDK.Page.getField('Credit_Card_Number');
  7. const currentFieldVal = currentField.getValue();
  8. console.log(currentFieldVal);

  9. //checking if field value is empty or not
  10. if (currentFieldVal == "") {

  11.     //showing confirmation pop-up in UI to proceed further
  12.     confAlert = ZDK.Client.showConfirmation('Are you *sure*?', 'Yes. Got it!', 'Nope');

  13.     //if selected 'Nope', then updating field with previous value using variable 'creditCardPrevValu'
  14.     if (confAlert == false) {
  15.         // console.log("entered");
  16.         var creditCardField = ZDK.Page.getField('Credit_Card_Number');
  17.         creditCardField.setValue(creditCardPrevValu);
  18.     }
  19. }
  1. Code Explanation

-> Script will fetch the current opened record and get field (Credit Card Number) previous value which was present before triggering Client Script and store in a variable.

-> Then, it will fetch the same field value with current data (modified by end user) and store in a variable.


-> Then, it checks if field (Credit Card Number) is empty or not with current data (stored in variable - currentFieldVal). 


-> If field is Empty - then it shows the confirmation pop in UI to proceed further by end user. If user clicks on Yes, then no action required. If user clicks on No, then it updates the field with previous value(stored in variable - creditCardPrevValu).

Working Demo - Screencast


Idea
-> User can configure the same setup for Detail Page as well.
-> Also, user can setup this for multiple fields(based on Page Event -> OnChange) on a page to mitigate such data loss risk.

AlertTo ensure a smooth implementation, we recommend configuring and testing the setup in the sandbox environment before deploying it to production.

TIPS - Avoid Common Errors

-> Ensure to use the correct API Names for both Module & Fields in the script.

-> To ensure you get the intended output, we would suggest you to add logs() || console.log() to each variable to check the output for seamless functionality. i.e., you could view the output in the "Messages" tab within Client Script IDE for each logs() print. To view console logs, you could follow - "Right Click on browser page >> Inspect >> Console".

-> In case the expected functionality does not work, then try the script by verifying each output & loop along with that, cross-verify the syntax of each ZDK Client/CRM API method in the provided sample help document. 

InfoSample Scripts for each ZDK Client/CRM APIs methods - Help Reference

Notes
Notes: Refer to the following Guide - Article to learn the best practices for Optimizing the code and various ways to deploy Client Script across Zoho CRM.



If you need any further clarifications, please don’t hesitate to contact partner-support@zohocorp.com.

Notes
Additionally, we kindly ask all Europe and UK Partners to reach out to partner-support@eu.zohocorp.com.

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          Zoho CRM Training Programs

          Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

          Zoho CRM Training
            Redefine the way you work
            with Zoho Workplace

              Zoho DataPrep Personalized Demo

              If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

              Zoho CRM Training

                Create, share, and deliver

                beautiful slides from anywhere.

                Get Started Now


                  Zoho Sign now offers specialized one-on-one training for both administrators and developers.

                  BOOK A SESSION







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsRetailOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceForms for Solopreneurs
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit
                              Forms for Government
                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic FormsInsurance
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsWufoo alternativeEncrypted Forms
                              Accessible FormsTypeform alternativeSecure Forms

                              WCAG

                                          Create. Review. Publish.

                                          Write, edit, collaborate on, and publish documents to different content management platforms.

                                          Get Started Now






                                                            You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                                                Manage your brands on social media

                                                                  Use cases

                                                                  Make the most of Zoho Desk with the use cases.

                                                                   
                                                                    

                                                                  eBooks

                                                                  Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho Desk.

                                                                   
                                                                    

                                                                  Videos

                                                                  Watch comprehensive videos on features and other important topics that will help you master Zoho Desk.

                                                                   
                                                                    

                                                                  Webinar

                                                                  Sign up for our webinars and learn the Zoho Desk basics, from customization to automation and more

                                                                   
                                                                    
                                                                  • Desk Community Learning Series


                                                                  • Meetups


                                                                  • Ask the Experts


                                                                  • Kbase


                                                                  • Resources


                                                                  • Glossary


                                                                  • Desk Marketplace


                                                                  • MVP Corner



                                                                    Zoho Sheet Resources

                                                                     

                                                                        Zoho Forms Resources


                                                                          Secure your business
                                                                          communication with Zoho Mail


                                                                          Mail on the move with
                                                                          Zoho Mail mobile application

                                                                            Stay on top of your schedule
                                                                            at all times


                                                                            Carry your calendar with you
                                                                            Anytime, anywhere




                                                                                  Zoho Sign Resources

                                                                                    Sign, Paperless!

                                                                                    Sign and send business documents on the go!

                                                                                    Get Started Now




                                                                                            Zoho TeamInbox Resources





                                                                                                      Zoho DataPrep Demo

                                                                                                      Get a personalized demo or POC

                                                                                                      REGISTER NOW


                                                                                                        Design. Discuss. Deliver.

                                                                                                        Create visually engaging stories with Zoho Show.

                                                                                                        Get Started Now










                                                                                                                              Wherever you are is as good as
                                                                                                                              your workplace

                                                                                                                                Resources

                                                                                                                                Videos

                                                                                                                                Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                                                eBooks

                                                                                                                                Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                                                Webinars

                                                                                                                                Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                                                CRM Tips

                                                                                                                                Make the most of Zoho CRM with these useful tips.



                                                                                                                                  Zoho Show Resources