4

I want to make a date field read only..using validation rule...i want to enter its value when any record is inserted in child object.A user shouldn't be allowed to enter any value at all on account record...the value will only be coming from child record.

How can i accomplish this..may be validation rule..i know i can make a read only field from page layout.

I also know about ischanged function in validation rule but a user can save a new record.it will only work if a first time value has been entered.

i need suggestions

Thanks in advance.

8

AND(ISCHANGED(Field__c), NOT(BlANKVALUE(PRIORVALUE(Field__c)))

This will allow the user to enter a new value assuming no prior value has been entered, but once a value is set, it is locked in place.

1
  • for picklist values you may use AND(ISCHANGED(Feild__c ), NOT(ISNULL(PRIORVALUE(Feild__c))))
    – user22791
    Aug 8 '15 at 1:45
6

If you don't want any users to be able to change a value, you should use Field Level Security (FLS) to make it read-only on a profile-by-profile basis.

  1. Go to the object's field page under Setup
  2. Click on the view link for the field
  3. Click the Set Field-Level Security button
  4. Change the field to read-only for the appropriate profiles

Note: I would only use a validation rule for this when the field should be read-only only under certain circumstances; for blanket coverage modifying FLS is more appropriate.

2
  • 1
    Except that you can't make a field "createable" (meaning, the user can insert a value but not update an existing one) using only FLS.
    – sfdcfox
    Oct 21 '13 at 20:42
  • Good point; this is only viable if the user does not need to supply an initial value.
    – Mike Chale
    Oct 21 '13 at 20:49

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.