+ Start a Discussion
Tolga SunarTolga Sunar 

Using Picklists in Formulas - Trailhead

Hello,

In the Admin Advanced --> Advanced Formulas --> Using Picklists in Formulas module, the challenge requirment is as follows:

"Create a validation rule formula that does not allow a user to mark a case as escalated unless the priority is set to 'High', the case was not Closed when Created, and the case isn’t closed."

I am setting up a valid formula (did a bunch of tests on Case object so I'm sure it is valid and I'm not going to post it here to let this remain as a challenge). I am using four fields, which are IsClosed, IsClosedOnCreate, Priority and Status, as understood from the challenge description.

However, checking the challenge gives me this error. Apparently, despite the description, we gotta use IsEscalated field instead of IsClosed:
User-added image

After I change IsClosed field with IsEscalated in the formula, I get this error:
User-added image

I am reproducing this scenario in a Case record and validation rule triggers.

Did anyone manage to pass this challenge? If not, could the Trailhead Dev Team have a look at wording of this challenge please? 

Thanks in advance.



 
Best Answer chosen by Tolga Sunar
Jennifer W. LeeJennifer W. Lee
Here's mine...

IsEscalated=TRUE && 
(NOT(ISPICKVAL(Priority, "High"))) || 
(ISPICKVAL (Status, "Closed")) || 
(IsClosedOnCreate=True)

All Answers

Jennifer W. LeeJennifer W. Lee
I passed it. Can you share your validation formula?
Tolga SunarTolga Sunar
Here's the formula:
 
ISPICKVAL(Status, "Escalated") && (IsClosedOnCreate || IsEscalated || NOT(ISPICKVAL(Priority, "High")))
Jennifer W. LeeJennifer W. Lee
Here's mine...

IsEscalated=TRUE && 
(NOT(ISPICKVAL(Priority, "High"))) || 
(ISPICKVAL (Status, "Closed")) || 
(IsClosedOnCreate=True)
This was selected as the best answer
Tolga SunarTolga Sunar
Thanks Jennifer. Apparently my own answer was correct in a way, but I was using the wrong fields for the "Closed" and "Escalated" criteria. I think other challengers may benefit from an extra, little hint on the challenge description, for preventing possible mistakes similiar to mine.
Bruce Palmer 1Bruce Palmer 1
To Tolga and Sunar,

Thank you for the insight on the need to use the IsEsclated field as part of the solution. Unfortunately, the challenge checker passed the following answer in my case:
IsEscalated = TRUE && NOT(ISPICKVAL(Priority, "High"))
Not that I thought this was a correct answer! It is missing the two other OR conditions (status=closed and IsClosedOnCreate=TRUE) that are supposed to also trigger the rule. In other words, the challenge checker took it as sufficient that Priority be something other than "High". However, on a test record, I am able to take a Closed case and change it back to Escalated, one of the editing actions the challenge was specifically designed to prevent. So in my case the checker passed a challenge answer that should not have passed.

That said, I appreciate that Trailhead is free, and it is probably unreasonable to expect perfection in the answer checking. Hence the usefulness of this forum.

Thank you again for your help.
Andrew EversleyAndrew Eversley
Thank you's to @Jennifer Lee and @Tolga Sunar for your assistance with this challenge. I was stuck on how to proceed with my coding but your insights helped me through. Appreciate it.
NiteshNitesh

@Jennifer's answer is almost correct and might pass the challenge but will not work in a real scenerio. I have update her answer below to work perfectly.

IsEscalated=TRUE && 
((NOT(ISPICKVAL(Priority, "High"))) || 
(ISPICKVAL (Status, "Closed")) || 
(IsClosedOnCreate=True))

Meekle MatterMeekle Matter
Oddly enough, I made sure to make sure it could not be escalated if priority was not set to "High" and it passed me.
  Code:  IsEscalated=True && NOT(ISPICKVAL(Priority,"High"))

I don't know if it is actually checking if the case is closed or not.  I originally placed ISPICKVAL (Status,"Closed") in it and was running into the IsEscalated problem.  I started from scratch and the top worked.

Thank you for those that put in their insight, I like seeing the full code that other people put it and had success with.  I greatly appreciate @Nitesh 's response.
amine elmrabetamine elmrabet
Here's another Possibility : Validated !

OR(
AND (ISPICKVAL(Status, "Escalated"), IsClosed, IsClosedOnCreate) , NOT(ISPICKVAL( Priority, "High")))
kathy maass 4kathy maass 4
I am still having issues with this challenge. I am thinking I set up my fields wrong. Can someone help me. 
Bhagyashree SuryavanshiBhagyashree Suryavanshi
I am facing error as  Challenge Not yet complete... here's what's wrong: 
The validation rule does not appear to be working correctly. Marking IsEscalated to true and Priority to Medium did not fire the validation rule.
Bhagyashree SuryavanshiBhagyashree Suryavanshi
Formula should IF( IsEscalated , OR(IsClosedOnCreate , 
ISPICKVAL(Status, "Closed"), 
ISPICKVAL(Priority, "Low"), 
ISPICKVAL(Priority, "Medium")), 
null)
Michael Yocca 4Michael Yocca 4
This answer worked for me. 

AND(
   IsEscalated=TRUE,

OR(
   NOT(IsPICKVAL(Priority, "High")),
   ISPICKVAL(Status,"Closed"),
   IsClosedOnCreate=True
))
Blair ColeBlair Cole
this works for me

and
(IsEscalated ,
or
(ISPICKVAL(Status, "Closed"),
 not(ISPICKVAL(Priority, "High"))
 )
)

IsClosedOnCreate is not being checked by the Test
Ranga WickramadaraRanga Wickramadara
Almost similar to the above one.... this is what worked for me
AND(
   IsEscalated,
   OR(
      
      ISPICKVAL(Status, "Closed"),
      IsClosedOnCreate,
      NOT(ISPICKVAL(Priority, "High"))
      
     )

)
Joseph KennedyJoseph Kennedy
This has been a very informative thread. 

I still don't understand why this dosn't satisfy the demands of the challenge. 

(ISPICKVAL(Status, "Escalated")) &&

(BEGINS(TEXT(PRIORVALUE(Status)), "Closed") ||

ISPICKVAL(Priority, "Low") ||

ISPICKVAL(Priority, "Medium") || 

(IsEscalated = TRUE))

Any feedback or discussion would be greatly appreciated.
Sébastien BRUCKERTSébastien BRUCKERT
A straight forward one is :

AND(
    IsEscalated,  
    OR(
              BEGINS(TEXT(PRIORVALUE(Status)), "Closed"),
                    NOT(ISPICKVAL(Priority,"High"))
      )                
)
Scott.EngScott.Eng
After running into this problem myself, and reviewing the passing answers, I think the issue is with conflicting wording in the challenge.
The validation rule should fire if someone tries to set a case as escalated and it is closed, closed when created, or does not have a priority of High.
This is intended to be interpreted as, "the Case is Escalated, and either the case is closed, closed on create, or does not have priority of High".
If you write the validation in this way, it will pass.

What's misleading is the Error message, which states:
The validation rule should display the error message 'You can only set a case as escalated if it is high priority and not closed' under the Escalated field when triggered.
The error message implies that the logic should be, "only allow a case to be escalated if is it high priority and not closed".  
 
Michael Camilleri 6Michael Camilleri 6
Nitesh, your answer is a few years old so I don't know if you'll see this, but I was wondering WHY you changed Jennifer's answer slightly by adding an additional 2 parentheses?  You mention in your response that it works better in real-world scenarios. Could you elaborate on how your answer works differently than Jennifer's answer? Thank you all for the input and different examples!