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
A 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.
Why It is Important:
- Data Protection
- Compliance Assurance
- Mitigated Risk
- Accident Prevention
- Enhanced Confidence
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
- //fetching record details and getting privious value of field(Credit Card Number)
- recDetails = $Page.record;
- creditCardPrevValu = recDetails.Credit_Card_Number;
- console.log(creditCardPrevValu);
- //fetching same field with current value(after making update)
- var currentField = ZDK.Page.getField('Credit_Card_Number');
- const currentFieldVal = currentField.getValue();
- console.log(currentFieldVal);
- //checking if field value is empty or not
- if (currentFieldVal == "") {
- //showing confirmation pop-up in UI to proceed further
- confAlert = ZDK.Client.showConfirmation('Are you *sure*?', 'Yes. Got it!', 'Nope');
- //if selected 'Nope', then updating field with previous value using variable 'creditCardPrevValu'
- if (confAlert == false) {
- // console.log("entered");
- var creditCardField = ZDK.Page.getField('Credit_Card_Number');
- creditCardField.setValue(creditCardPrevValu);
- }
- }
-> 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
-> 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.
To ensure a smooth implementation, we recommend configuring and testing the setup in the sandbox environment before deploying it to production.