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

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 '18 at 9:44
0

You can do it like

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.