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
balaji_SFDCbalaji_SFDC 

validation rule

Hi Experts,

In my org There is one picklist Field.in this field 2 values are there.if i select 1st value the next text field value get disabled.if i select 2nd value the text field value get enabled .how to write validation rule for this criteria.
   
           Could any one can help me
Vinita_SFDCVinita_SFDC
Hi,

There are couple of ways to achieve this. Please refer following threads:

https://developer.salesforce.com/forums/ForumsMain?id=906F000000096EnIAI

https://success.salesforce.com/answers?id=90630000000h1XrAAI

http://stackoverflow.com/questions/10015597/display-fields-based-on-selection-on-a-picklist-selection
balaji_SFDCbalaji_SFDC
Hi vinita,
 
              I am not asking through apex code.I am asking is it achieve through validation rule.

 Thanks for your reply
Prabu MahalingamPrabu Mahalingam
Hi,
We cannot enable or disable a text field through validation rule. If your goal is to restrict users from entering values into a text field depending on pick-list value then below is the validation rule for that.

AND(ISPICKVAL(PickListField__c,'First Value') , TextField__c !='')

you can provide error message like

if the pick list value is 'something' then the text field must be balnk.

cheers...!
Vinita_SFDCVinita_SFDC
Hi,

Disabling a field is not possible by using validation rule, that is why i suggested to achieve this with coding.