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
CloudPowerCloudPower 

Validation rule to check if the string contains all the special characters.

Hi,

I need to create a VR inorder to throw an error when tried to save a custom field of type string with all special characters in it.

Ex:   CustomField__c = '@@@@$$$%%';

 

In other words i dont want a field to save with only special characters in it. The special characters can exists in combination with alphanumeric characters but cant exists independantly.

 

 

Tried using ReGEX but couldn't succeed .

Please provide if any soln.

 

Thanks

 

 

 

Navatar_DbSupNavatar_DbSup

Hi,

 

Try the below formula condition in validation rule as reference:

 

OR( ISNUMBER(Name), OR(CONTAINS(Name, "!"),CONTAINS(Name, "@"),CONTAINS(Name, "#"),CONTAINS(Name, "$"),CONTAINS(Name, "$"),CONTAINS(Name, "%"),CONTAINS(Name, "^"),CONTAINS(Name, "&"),CONTAINS(Name, "*")))

 

 

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

CloudPowerCloudPower

Thanks for the reply Navatar.

The Validation rule works fine if the string(Name) contains any special characters but here my requirement is to allow the special characters in combination with alpahanumeric characters and avoid if the string contains only special characters without any alphanumeric characters in it.

 

Ex:

Name = '@@@@@@####';(Dont allow)

Name = '@@@@@@####123aqQ';(Allow)

 

 

CloudPowerCloudPower

Can anyone suggest other work around for this scenario?