function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JoannaAtMaritzJoannaAtMaritz 

How to Display Fields Differently Based on a Checkbox Field

We want to add a new custom checkbox field "BU Touched" to the Opportunity object.  If this field is true, then we want to display Amount, GP and Fee Income as read-only.  If it is false, then we want the 3 fields to be editable.

I believe that this can be done via Record Type.  But, our record types are already so numerous that this would add a lot of complexity to our system - just to accomplish this simple interface customization.  

Is there any other way to do this?  Or if not making the fields read-only, could we have some other kind of visual indication on the screen, and then we could write some validation rules to prevent the save if someone tried to edit the fields if the checkbox is true?  Any ideas?  Thanks.
Best Answer chosen by Admin (Salesforce Developers) 
SteveBowerSteveBower

I don't think there is an approach to enable/disable the fields unless you use VisualForce.  RecordTypes would also work as you noted.

 

You could have a Formula field placed on the layout above the three fields in question.  Have it set the value of the field to blank of the fields are editable, and "These fields may not be edited one the BU is Touched" (etc.)  That way you can have a formulaic visual indicator. 

 

Then, as you wrote, use validation rules to prevent any edits.

 

Best, Steve.