SugarCRM: How do I make “first name” and “salutation” required fields on the “Convert Lead to Contact” form?

StackOverflow https://stackoverflow.com/questions/374906

  •  22-08-2019
  •  | 
  •  

Question

We use a customized installation of SugarCRM and I need to make a change to the "Convert Lead to Contact" form. On the form, only "last name" is marked as required, but if the user does not enter a salutation or first name, Sugar will throw an SQL error on the insert (because salutation and first name are required fields for contacts).

I've tried adding this line to "modules/Contacts/metadata/editviewdefs.php" and "modules/Contacts/metadata/quickcreatedefs.php":

array (
'name' => 'first_name',
'displayParams'=>array('required'=>true),
)

I'm trying other modifications but I can't find anything online yet on this exact problem. I will update this question with my findings. Thanks!

Update: Added "first_name" and "salutation" to the 'required_fields' array in "modules/Contacts/field_arrays.php", did not help.

Update: This is on SugarCRM 5.1. This work is happening during the upgrade to 5.1.

Update: Added the following line to "modules/Contacts/vardefs.php" the "email_and_name1" array, did not help.

'required' => 'true',
Was it helpful?

Solution 2

I appear to have figured out a solution. I created an upgrade file in "custom/Extension/modules/Contacts/Ext/Vardefs" called "custom.php". The contents of the file are below:

<?php
$dictionary['Contact']['fields']['salutation']['required'] = true;
$dictionary['Contact']['fields']['first_name']['required'] = true;
?>

After I did a "quick repair and rebuild", the salutation and first name were now required. This works for me.

OTHER TIPS

The above didn't work for me. I am using 5.2.0.

What worked for me was to edit custom/modules/{modulename}/metadata/editviewdefs.php and add:

'name' => 'first_name', 'displayParams' => array ( 'required' => true, ),

Then quick repair/rebuild.

Why not just make Fist Name and Salutation required fields in Leads? Then you can modify the fields to "required" right in Studio and not have to worry about upgrade security.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top