We have considered the Account Module to validate the checkbox is checked/unchecked while saving the record in the Module.
Scenario: If Account Module having the Type = “Analyst” then Checkbox Field must be checked. If Checkbox Field is unchecked then show the Validation Message in the alert box and disallow to save the record.
Below are the screenshots. In which User Select the Type = “Analyst” and Checkbox Field is unchecked. So it shows the alert message.
To achieve this needs to do the following customization in your CRM.
- Register Logichook by creating a Logichook Registration file on the below path and add code as shown in the below screenshot.
File Path : custom/Extension/application/Ext/LogicHooks/ValidateCheckBoxValueLogicHook.php
- Create a Logichook file on the path below and add code as shown in the below screenshot.
File Path :
Note : You can replace the Module Name in the Condition. Currently we have considered Account Module that’s why added Account Module in the Condition.
- Create a js file on the below path & add code as shown in the below screenshot.
File Path : custom/include/ValidateCheckBoxValue/js/ValidateCheckBoxValueEditView.js
Note : In this file you just need to replace your dropdown field id with “#account_type”, Account Type Condition like Currently we have accountType = “Analyst” and checkbox field id with “#checboxfield_c”.
I hope it will help you