+ Start a Discussion
mamta1mamta1 

How to make a field non-editable after creation?

I have an object with many fields that should be editable when a NEW record is being created. However, only 2 of these fields should be editable for an existing record. Other fields should not be editable for existing record. I thought I could use field-level security settings. But using that, the fields are not editable even at Create-time. How can I make a field to be editable at create-time (new record) but non-editable at edit-time (existing record).

shillyershillyer

You can create a validation rule using ISCHANGED to prevent changes to certain fields. Here's an example with Opportunity Name.

 

The following validation rule prevents users from changing an opportunity name after it has been created:

NOT(ISCHANGED(Name))

.

Hope that helps,

Sati

mamta1mamta1

Gerat! I will try this out. Is there a way we can make the field look as read-only on Edit-screen?

RockDeveloperRockDeveloper

Hi,

 

You can use the combination of PRIORVALUE, ISCHANGED and ISBLANK in your validation rule.

 

AND(

   ISCHANGED(Field__c),

   NOT ISBLANK(PRIORVALUE(Field__c))

)

Jason DunhamJason Dunham
@shillyer nice short answer, but the "NOT" should be removed. The validation rule prevents a change when the expression evaluates to TRUE.
Jay kerson ReponteJay kerson Reponte
I tried this and work but it only works when the user clicks the edit button and when they click the inline edit which is the pencil type they can edit... Please help