Sugarcrm 7 remove "required" attribute

Hello everyone !

On these threads, there are a lot of ways to make a field required, like adding a validationTask via record.js...

What i want :
But, i would like to do exactly the contrary : i would like to remove the required attribute of a field.
On the standard related field "account_name" created by Sugar on Cases module, for the standard relationship account_cases .
So, when i create or edit a Case, i have the Account Name field required every time. But this is quite ridiculous, because a Case is opened by a physical person, not an enterprise. So i would like to remove this obligation.

What i did :
I tried to add a custom vardef in case module :
/custom/Extension/modules/Cases/Ext/Vardefs/customVardef.php
with the following $dictionary code in it :

<?php$dictionary["Case"]["fields"]["account_name"]["required"] = false;
$dictionary["Case"]["fields"]["account_id"]["required"] = false;
?>

And did a QRR.

Aaaaannnd .. nothing happened.

I don't want to disable "required" for account_name on EVERY modules, ONLY on Cases.
So i don't want to write anything in config_override.php.
And this is a field created by Sugar, so I can't uncheck the "required" box via the Studio.

Please, could you help me with this ?

Thanks a lot :)
Parents
  • Hello,

    To take the requirement to have an account associated to the contact or opportunity

    Edit the file: config_override.php, this file is in the root of Sugar


    Insert the following line to remove the need to have an account to contact

       $ sugar_config ['require_contact'] = false;

    Insert the following line to remove the need to have an account for oportindade

       $ sugar_config ['require_accounts'] = false;


    Go to admin panel

    repair

    Quickly Repair and Rebuild
  • There is probably a more clever way of doing this, but you can do it by copying /modules/Cases/clients/base/views/record/record.php over to custom/ and then change the:

    'account_name',   
    In the panels array to an array and set required = false:

                    array(                    
                        'name' => 'account_name',
                        'required' => false,
                    ),

    Then do a Quick Repair & Rebuild.


  • Thanks to @eggsurplus and his really simple and effective answer, i managed to un-require the account_name field !
    so, the result is :

    custom/modules/Cases/clients/base/view/record/record.php

    array(                    
                        'name' => 'account_name',
                        'required' => false,
                    ),
      Hope it will help someone !
Reply Children
No Data