You need to sign in to do that
Don't have an account?
Diptonil Deka 8
how to restrict specific string characters on name fields?
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 "
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 "
Try The Below Validation Rule Please Mark It As Best Answer If It Helps
Thank You!
All Answers
Try The Below Validation Rule Please Mark It As Best Answer If It Helps
Thank You!
I think you can either use a validation rule or trigger for trigger you can try the below snippet:
Please do note that I have added only for the first name you will have to add the conditions for middle and last name as well as per the scenario you are implementing.
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
You can provide the valdition on input field and check the value onkeypress or onchange event if the value matches with your validation rule than that must be enter otherwise they provide some error.
for your reference i provide you some input field validation program links:
http://salesforcecodes.com/input-text-restrictnumber-alphabets-special-characters-keyboard-typing-in-lightning-component/
https://www.infallibletechie.com/2020/10/how-to-restrict-users-to-avoid-entering.html
If you find your answer than mark as a best answer
Thanks And Regards,
Suraj Tripathi.
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'))