Requirement is I have a check box on Case object ISEsclated and one textfield is reason. when checkbox in not checked it's show readonly form that no one write in the reason text field and if IsEsclation checkbox is checked then Reason textField show in editable mode anyone can write and save record.

  • 2
    This is not possible on standard layouts, but could be done with a visualforce page or lightning component. – martin Feb 27 '17 at 7:40
  • With validation rule,what you can achieve is user will not be able to change the value of reason field when checkbox is not checked. – Samir Feb 27 '17 at 7:42
  • @martin i know it can be possible from vfpage itself using rendered true/false – cloudZigZag Feb 27 '17 at 7:57
  • Can be done using JavaScript. If you've tried some code please share. It would be helpful to give you answer. – Rohit Mourya Feb 27 '17 at 8:41

You can do this by assigning a different record type with a workflow. This record type would have a separate pagelayout with the fields you require to be read only set as such.

  • i have already created validation AND( IsEscalated = FALSE , ISCHANGED(Escalation_Reason__c ), NOT( ISBLANK( Escalation_Reason__c ) )) But i need to see field readonly when checkbox is not checked from standard format. i know it is possible from class and vfpage but requirment is do from standard format like validation rule, workflow, process builder etc. – cloudZigZag Feb 27 '17 at 7:47
  • I have updated my answer. – Samir Feb 27 '17 at 7:53

It can be done with custom VF page: you can create 2 output panels in one you create inputField in other you create outputfield and then you can simply render each of them with one boolean.

VF page:

    <apex:page standardcontroller="ISEsclated" extensions="customcontroller" >
     <apex:commandbutton action={!ShowHide} />
     <apex:outputPanel id="panel1" />
      <apex:outputPanel rendered="{!enabled==true}" />
       <apex:outputText value="{ISESCELATED.reason}" />

     <apex:outputPanel id="panel2" />
         <apex:outputPanel rendered="{!enabled==true}" />
           <apex:inputField value="{ISESCELATED.reason}" />


Custom controller:

public boolean enabled{get;set;}

public void ShowHide(){
enabled = true 

Something like that, I hope that helps you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.