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
AKS018AKS018 

Validation rule on fields

HI,

 

       How to write the Validation rule on Record fields, that if the field has data the user not to modify that. If the field is empty means have allow to modify.

 

Here I wrote like this, But doesnt work properly.

 

OR(
AND(NOT( ISBLANK( IP__c ) ) ,ISCHANGED(IP__c )),
AND(NOT( ISBLANK(IP_Justification__c)),ISCHANGED(IP_Justification__c ) ),
AND(NOT( ISBLANK( Subdomain__c) ) ,ISCHANGED(Subdomain__c)),
AND(NOT( ISBLANK( SMTP_Username__c) ) ,ISCHANGED(SMTP_Username__c )),
AND(NOT( ISBLANK( DKIM_String__c) ) ,ISCHANGED(DKIM_String__c )),
AND(NOT( ISBLANK( FTP_Password__c) ) ,ISCHANGED(FTP_Password__c)),
AND(NOT( ISBLANK( FTP_Username__c) ) ,ISCHANGED(FTP_Username__c)),
AND(NOT( ISBLANK( POP_Password__c) ) ,ISCHANGED(POP_Password__c )),
AND(NOT( ISBLANK( POP_Username__c) ) ,ISCHANGED(POP_Username__c )),
AND(NOT( ISBLANK( SMTP_Password__c) ) ,ISCHANGED(SMTP_Password__c )),
AND(NOT( ISBLANK( SMTP_Username__c) ) ,ISCHANGED(SMTP_Username__c )),
AND(NOT( ISBLANK( Speed_Limit__c) ) ,ISCHANGED(Speed_Limit__c)) ,
AND(NOT( ISBLANK( Status_Date__c) ) ,ISCHANGED(Status_Date__c))


)

 

Can you please help how to write on fields.

 

Scenario:

If the record field data is there means, we restrict the user not to modify.

If the record field data is empty means, allow to user to enter data in to that field.

Rahul_sgRahul_sg

Use Previous value function to check if previous value is not null in combination with the ischanged function.

sandeep@Salesforcesandeep@Salesforce

it will work : 

IF(
OR(
AND(ISCHANGED( IP__c ) , PRIORVALUE(IP__c ) = NULL ),
AND(ISCHANGED(IP_Justification__c), PRIORVALUE(IP_Justification__c ) ),
AND(ISCHANGED( Subdomain__c) , PRIORVALUE(Subdomain__c) = NULL ),
AND(ISCHANGED( SMTP_Username__c) , PRIORVALUE(SMTP_Username__c ) = NULL ),
AND(ISCHANGED( DKIM_String__c) , PRIORVALUE(DKIM_String__c ) = NULL ),
AND(ISCHANGED( FTP_Password__c) , PRIORVALUE(FTP_Password__c) = NULL ),
AND(ISCHANGED( FTP_Username__c) , PRIORVALUE(FTP_Username__c) = NULL ),
AND(ISCHANGED( POP_Password__c) , PRIORVALUE(POP_Password__c ) = NULL ),
AND(ISCHANGED( POP_Username__c) , PRIORVALUE(POP_Username__c ) = NULL ),
AND(ISCHANGED( SMTP_Password__c) , PRIORVALUE(SMTP_Password__c ) = NULL ),
AND(ISCHANGED( SMTP_Username__c) , PRIORVALUE(SMTP_Username__c ) = NULL ),
AND(ISCHANGED( Speed_Limit__c) , PRIORVALUE(Speed_Limit__c) = NULL ),
AND(ISCHANGED( Status_Date__c) , PRIORVALUE(Status_Date__c) = NULL )
),
false,true)