+ Start a Discussion

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"))



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?


Best Answer chosen by Admin (Salesforce Developers) 


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.