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
pranavshahpranavshah 

Validation Rules in Salesforce

Hi Guyz,

I just want to create one simple vvalidation rule for a picklist value,

I am inserting a Library Name , once i fill the name, then there is Location with different picklist value.
For Eg: If user enter a name as "Mumbai Library"(Name Would be anything everytime), then location i would be selecting as "Mumbai", records get saved. but while editing the same record,it should not make me change to other location rather than Mumbai...
how it can be done...

I have wriiten below formula, but its not working as per my requirement

AND( ISPICKVAL( Location__c , "Mumbai"), NOT(ISBLANK( Name )) )

please help me to sort out

Regards
Pranav Shah

 
Best Answer chosen by pranavshah
VamsiVamsi
Hi,

You can try the below, If you would like to trigger this only for mumbai locations (So if a user enters any other location other than mumbai then it throws the error).

TEXT(Location__c ) <> "Mumbai"

else if you would like to make it based on location value then 

TEXT(Location__c ) <> PRIORVALUE(Location__c )

Hope this helps ...!!!

Please mark as best answer if the above helps ...!!!