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
KimberlyJKimberlyJ 

Am I using REGEX correctly?

I have Professional Edition.

I need a validation rule if the name of the object is NOT EQUAL to "Labor" then the Profit field needs to be required.  I think I did it backwards, but it wont force someone to fill in the Profit field if the name is not "Labor".

 

AND(REGEX(Name, "Labor"))

&&(Profit_c)>0

 

This works great!

But if the name is not Labor, i need Profit to be >0. It wouldn't take <> in front of "Labor".

 

Am I going about this all backwards?

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,

Try the below formula in validation rule:

If(Name <>"Labor", ISBLANK(Profit__c ) ,false)

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.