• Diptonil Deka 8
  • NEWBIE
  • 10 Points
  • Member since 2021

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 1
    Replies
is it possible to restrict string ' dr/DR/dR/MR/mr/Mr or Test or Clinic or Dummy or specific characters' in name fields of  an custom object by validation rule? I am able to restrict when used as prefix.

What to do to restrict in middle of an word in the name fields or as suffix of the name in the name field?

Eg: Amanclinic  // should not allow clinic or other mention strings.
Eg: Amandummykumar  //shouldnot allow in middle of the name to                                                enter in the string. Should throw validation                                                                                                       error

my validation rule:

AND(OR(CONTAINS( First_Name__c , 'DR'),CONTAINS( First_Name__c , 'MR'),CONTAINS( First_Name__c , 'Dr'),CONTAINS( First_Name__c , 'Mr'),
CONTAINS( First_Name__c , 'Test'),CONTAINS( First_Name__c , 'Clinic'),CONTAINS( First_Name__c , 'Dummy'),NOT(REGEX( First_Name__c , "^[a-zA-Z_]*$")),CONTAINS( Middle_Name__c , 'DR'),CONTAINS( Middle_Name__c , 'MR'),CONTAINS( Middle_Name__c , 'Dr'),CONTAINS( Middle_Name__c , 'Mr'),CONTAINS( Middle_Name__c , 'Test'),
CONTAINS( Middle_Name__c , 'Clinic'),CONTAINS( Middle_Name__c , 'Dummy'),NOT(REGEX( Middle_Name__c , "^[a-zA-Z_]*$")),CONTAINS( Last_Name__c , 'DR'),CONTAINS( Last_Name__c , 'MR'),
CONTAINS( Last_Name__c , 'Dr'),CONTAINS( Last_Name__c , 'Mr'),CONTAINS( Last_Name__c , 'Test'),CONTAINS( Last_Name__c , 'Clinic'),
CONTAINS( Last_Name__c , 'Dummy'),NOT(REGEX( Last_Name__c , "^[a-zA-Z_]*$"))),(RecordType.Name = 'Doctor'))
 
my requirement is: 
As a user, i want to be able to enter proper name in First name, Middle name or Last name boxs in Personal details section on an in Salesforce Given that the details can be created manually or can be uploaded from the Backend.
When i try to edit First, middle or Last name on Personal details section in the object  then if i  enter dr/DR/dR/MR/mr/Mr or Test or Clinic or Dummy or any special character or space or numeric input as a Prefix and click on save then it should throw error as: 

 "can't add Dr/Mr or  Test or Clinic or Dummy or any special characer or space or numeric input as prefix or suffix "
my requirement is: 
As a user, i want to be able to enter proper name in First name, Middle name or Last name boxs in Personal details section on an in Salesforce Given that the details can be created manually or can be uploaded from the Backend.
When i try to edit First, middle or Last name on Personal details section in the object  then if i  enter dr/DR/dR/MR/mr/Mr or Test or Clinic or Dummy or any special character or space or numeric input as a Prefix and click on save then it should throw error as: 

 "can't add Dr/Mr or  Test or Clinic or Dummy or any special characer or space or numeric input as prefix or suffix "