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
Claire NicolayClaire Nicolay 

Problem with validation rule

Hi, Can somebody help with the following rule, which triggers when the field is empty even though it should not (that is why I used the OR function but something seems to be wrong with the formula:

AND (
OR(
 ISBLANK( Website ), 
AND(
   RIGHT(  Website , 4) <> ".COM",
   RIGHT( Website, 4) <> ".com",
   RIGHT( Website, 3) <> ".FR",
   RIGHT( Website, 3) <> ".fr",
   RIGHT( Website, 4) <> ".NET",
   RIGHT( Website, 4) <> ".net",
   RIGHT( Website, 4) <> ".org",
   RIGHT( Website, 4) <> ".ORG"
)))
Best Answer chosen by Claire Nicolay
Ajinkya1225Ajinkya1225
Hi Claire,

This should work-
 
AND( 
RIGHT( Website , 4) <> ".COM", 
RIGHT( Website, 4) <> ".com", 
RIGHT( Website, 3) <> ".FR", 
RIGHT( Website, 3) <> ".fr", 
RIGHT( Website, 4) <> ".NET", 
RIGHT( Website, 4) <> ".net", 
RIGHT( Website, 4) <> ".org", 
RIGHT( Website, 4) <> ".ORG", 
NOT( ISBLANK(Website)) 

)

Can you take a moment to  upvote and mark this answer as solved, if it helped you.
Cheers!
Ajinkya Deshmukh

All Answers

Amit Chaudhary 8Amit Chaudhary 8
Please try to update your validation rule like below
OR(
	ISBLANK( Website ), 
	AND(
		RIGHT(  Website , 4) <> ".COM",
		RIGHT( Website, 4) <> ".com",
		RIGHT( Website, 3) <> ".FR",
		RIGHT( Website, 3) <> ".fr",
		RIGHT( Website, 4) <> ".NET",
		RIGHT( Website, 4) <> ".net",
		RIGHT( Website, 4) <> ".org",
		RIGHT( Website, 4) <> ".ORG"
	)
)

Let us know if this will help you
Ajinkya1225Ajinkya1225
Hi Claire,

This should work-
 
AND( 
RIGHT( Website , 4) <> ".COM", 
RIGHT( Website, 4) <> ".com", 
RIGHT( Website, 3) <> ".FR", 
RIGHT( Website, 3) <> ".fr", 
RIGHT( Website, 4) <> ".NET", 
RIGHT( Website, 4) <> ".net", 
RIGHT( Website, 4) <> ".org", 
RIGHT( Website, 4) <> ".ORG", 
NOT( ISBLANK(Website)) 

)

Can you take a moment to  upvote and mark this answer as solved, if it helped you.
Cheers!
Ajinkya Deshmukh
This was selected as the best answer
Claire NicolayClaire Nicolay
Thank you both for the hep. Can I ask you how to write a formula that would ensure that the first letter of a field is a capital letter? I would use it in a WF with field update. Thanks!
Ajinkya1225Ajinkya1225
Claire,

Follow these steps:
  1. Setup | Create | Workflows & Approvals | Workflow Rules.
  2. New Rule.
  3. Select the Object.
  4. Evaluation Criteria: created and every time it's edited.
  5. Rule Criteria: formula evaluates to true.
  6. Formula:
    AND(
        NOT(ISBLANK(FirstName)),
        OR(
            ISNEW(),
            ISCHANGED(FirstName)
        ),
        LEFT(FirstName, 1) <> UPPER(LEFT(FirstName, 1))
    )
  7. Save & Next.
  8. From under Immediate Workflow Actions, click Add Workflow Action to select Field Update.
  9. Select the Field to Update: FirstName.
  10. Select User a Formula to Set the new Value.
  11. Click Show Formula Editor.
  12. Formula:
    UPPER(LEFT(FirstName, 1)) &
    MID(FirstName, 2, LEN(FirstName))
  13. Save.
  14. Done.
  15. Activate.

Cheers!
Ajinkya
Claire NicolayClaire Nicolay
thanks a lot ajinkya, it works!