0

I'm using the following formula in a validation rule:

IF(ISPICKVAL(Level_Name__c ,"Level"),
IF(CONTAINS(Name,"ONE")||
CONTAINS(Name,"TWO")
,TRUE, FALSE), FALSE)

How can I get the last three characters of the Name and compare with Level_Name__c except for the "Level" value?

2 Answers 2

2

How can I get the last three characters of the Name

Use the Right function RIGHT(text, num_chars) - documentation link

RIGHT(Name, 3)

and compare with Level_Name__c except for the "Level" value

It seems contradictory, when your Level_Name__c is "Level" it doesn't make sense to compare it with some value that is 3 characters long - the result will always be false.

If you still need to compare a picklist value with some text, then you need to use the TEXT(value) function.

And your formula would be:

IF(RIGHT(Name, 3) == TEXT(Level_Name__c), TRUE, FALSE)
1
  • Cheers, much appreciated.
    – lemdev
    Dec 11, 2018 at 9:44
0

You can do it like

Contains(TEXT(Level_Name__c),RIGHT(name,3))

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .