Opportunity Probablity Input - Set to ReadOnly

Hi all,

I know setting a field to readonly has been done to death, but I canā€™t get this to work.

I have the opportunity sales stage linked to the opportunity probablity. I want the probability to continue to change when the sales stage is altered whilst preventing the user from editing the field (but it still needs to be visible on edit/detail views).

Manually editing the source in Chrome devtools to the following is what I want to achieve, as it works perfectly.

<input type="text" name="probability" id="probability" size="30" value="90" title="" tabindex="0" readonly>

What Iā€™ve tried;

Editing ā€œcustom/Extension/modules/Opportunities/Ext/Vardefs/sugarfield_probability.phpā€ to

$dictionary['Opportunity']['fields']['probability']['readonly']=true; 

Editing ā€œcustom/modules/Opportunities/metadata/editviewdefs.phpā€ to

0 => array (
            'name' => 'probability',
            'type' => 'readonly',
          ),

or

0 => array (
            'name' => 'probability',
            'readonly' => true,
          ),

For all of the above, Iā€™ve performed a quick repair and cleared cache but the outcome is not what I want.

Any other suggestions?

Hello, maybe a Customcode:

ā€˜customCodeā€™ => ā€˜ā€™,

Salu2

2 Likes

Thank you, thatā€™s done the trick.