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
satakshisatakshi 

Validation Formula for Pickval If changed

I am writing validation formula. In lead source pickval while generating lead if pickval is web or if pickval is changed to web then it should throw error that pickval can not be change into web. I am writing this fromula but its not working. 
AND((ISCHANGED( LeadSource )) && ISPICKVAL( LeadSource , 'Web'))
Best Answer chosen by satakshi
DeepthiDeepthi (Salesforce Developers) 
Hi Satakshi,

Try to check the below validation rule:
As you don't want a lead record to be saved when the LeadSource is "Web" or changed to "Web"
(ISCHANGED( LeadSource) && ISPICKVAL( LeadSource , 'Web') )&& (PRIORVALUE(LeadSource) <> 'Web') || ( ISPICKVAL( LeadSource , 'Web'))


Hope this helps you!
Let me know if you need any help!!
Best Regards,
Deepthi

All Answers

satakshisatakshi
Hello,

Now i have changed this formula into ISPICKVAL( LeadSource , 'Web'). Now if while creating lead. If pickval is 'Web' then it will throw an error and if its edited and then changed into web then also it will through  an error. So that workflow is checking for a leadsource = web will not send any email. Is this right way to do this?
DeepthiDeepthi (Salesforce Developers) 
Hi Satakshi,

Try to check the below validation rule:
As you don't want a lead record to be saved when the LeadSource is "Web" or changed to "Web"
(ISCHANGED( LeadSource) && ISPICKVAL( LeadSource , 'Web') )&& (PRIORVALUE(LeadSource) <> 'Web') || ( ISPICKVAL( LeadSource , 'Web'))


Hope this helps you!
Let me know if you need any help!!
Best Regards,
Deepthi

This was selected as the best answer
satakshisatakshi
Thank you deepthi its working....
DeepthiDeepthi (Salesforce Developers) 
Hi Satakshi,

The previous Validation rule gives an error for any picklist value change. Kindly try the new updated rule that suffices your exact requirement. Sorry for the confusion.

Best Regards,
Deepthi
satakshisatakshi
Hi Deepthi,

   Thanks for correction. Its working

Thanks & Regards,
Satakshi