checkbox as required field in Leads module

hi All,

I am trying to ensure that checkbox is a required field in leads module. basically its a GDPR privacy statement and we need to make sure that checkbox is checked before submitting a lead in CRM. This needs to be cascaded into the partner portal as well. There is no option to make a checkbox mandatory via Studio, any recommendation on how this could be achieved would be great.

Thanks,

K

Checkbox studio options

  • Hi Kunal singh,

    As mentioned in the following link, currently you can not make 'HTML' and 'Checkbox' field types required via studio. 

    http://support.sugarcrm.com/Knowledge_Base/Studio_and_Module_Builder/Making_a_Field_Required_or_Unrequired/ 

    You will have to do this via dependency functionality of SugarCRM which will require developer skills. Following is the example of setting a field as Required via Dependencies.

    http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_7.9/Architecture/Extensions/Dependencies… 

    Regards,

    Junaid

  • thanks I am no developer but got this to work on sugar by following the chapter , however i need to get this validation to trigger through Sugar portal (i have a lead form on the portal) aswell as these are consent questions and needs to be answered and recorded in sugarcrm. Any guidance there would be highly appreciated. As they are validated for via trigger it doesnt work via the form.

  • This will not work by trying to archive this in SugarCRM Studio.

    Making a checkbox "required" is not possible as "required" means SugarCRM is expecting a value in a field other than "emtpy / null" , on checkboxes it can be 0 or 1 (true / false) but both possibilities are values and "required" is true logically.

    If you want to make sure a checkbox is ticked it must be checked before a form submits data to SugarCRM so you need to implement this in the website form you are using.

    This can look loke this:

    https://www.w3schools.com/tags/att_input_required.asp 

    Cheers

    Björn Canales Pfisterer

    Technical Support Manager

    provalida GmbH

  • Where is this lead form? Is it a standard Sugar portal functionality or some customized lead form?

    As Björn Canales Pfisterer already wrote and suggested you have to make a change in the lead form if possible.

    I am not sure how the lead form is set up and whether it is generated by sugar functionality or not. Following workaround may or may not work but you can give it a try if you have access to the code base

    Open the file placed at custom/Extension/modules/Leads/Ext/Vardefs/sugarfield_privacystatement_c.php and add the following line in it.

    $dictionary['Lead']['fields']['privacystatement_c']['required']=true;

    Remove the dependency customizations done earlier and then run Repair & Rebuild in your system.

    Note: I would recommend doing this first on your local copy of SugarCRM to make sure that everything is working properly.

    Regards,

    Junaid

  • Yes, checkbox contains 0 or 1 value and that's why sugar is not showing the required option in the studio. But still, you can make a checkbox required which means that record will be saved only if the checkbox is checked (i.e. value = 1/true) because when Sugar will perform a validation check on the field with value 0 or false it will be considered as empty hence prompting the user to mark the checkbox checked before saving the record.

    Regards,

    Junaid  

  • thanks Junaid, this worked   , thanks for your assistance and direction here it was great to find a resolution finally.

    Thanks,

    Kunal

  • making it required via Vardefs and synchronizing with portal all seems to be working as expected. thanks a lot again

  • Good to hear that. You can mark it as answered in case someone else looking for the same thing 

    Regards,

    Junaid