Use Picklists in Formulas Challenge - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Artur SchallerArtur Schaller 

Use Picklists in Formulas Challenge

Hello!
Can anyone help me with the "Use Picklists in Formulas" challenge. Below is my formula with the Syntax error message firing back.  I see that multiple ppl above me are having the same struggle. Any help will be great. 
This are the requirements:
  Create a validation rule for escalated cases.
  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.
  The validation rule should be on the Case object.
  The validation rule should be named 'Mark_as_Escalated'.
  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.
  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.
  Add the 'Escalated' field to the Case page layout.

User-added image

Thanks,
Artur
Best Answer chosen by Artur Schaller
Usman AliUsman Ali
Hi Artur,
Try this formula..
AND(IsEscalated ,OR( IsClosed, IsClosedOnCreate, NOT(ISPICKVAL( Priority , 'High')) ) )

or check below articles.
  • https://trailblazers.salesforce.com/answers?id=9063A000000aIyPQAU
  • https://trailblazers.salesforce.com/answers?id=9064S000000DMiDQAW
  • https://trailblazers.salesforce.com/answers?id=9064S000000DSMDQA4

All Answers

Usman AliUsman Ali
You should use 

TEXT(ISPICKVAL(Status)) <> 'Close'
Artur SchallerArtur Schaller
Thanks for the respnose Usman! I've went ahead and updated my formula to your suggestion and i'm still receving the bellow error.

Error: Incorrect number of parameters for function 'ISPICKVAL()'. Expected 2, received 1
Usman AliUsman Ali
ah my bad, use below one..
TEXT(Status) <> 'Close'

 
Artur SchallerArtur Schaller
That cleared my syntax error message. But i just now realized I've written my formula all messed up :-(. So I've re-written my formual, not syntax error messages but getting the error message on the complete of challenge: The validation rule does not appear to be working correctly. Marking IsEscalated to true and Priority to Medium did not fire the validation rule.

This is my new formual: ISPICKVAL(Status, "Escalated") && NOT(ISPICKVAL(PRIORVALUE(Status), "Closed")) && TEXT(Status) <> "Closed" && TEXT(Priority)   <>  "Low" || TEXT(Priority) <> "Medium"
Usman AliUsman Ali
Hi Artur,
Try this formula..
AND(IsEscalated ,OR( IsClosed, IsClosedOnCreate, NOT(ISPICKVAL( Priority , 'High')) ) )

or check below articles.
  • https://trailblazers.salesforce.com/answers?id=9063A000000aIyPQAU
  • https://trailblazers.salesforce.com/answers?id=9064S000000DMiDQAW
  • https://trailblazers.salesforce.com/answers?id=9064S000000DSMDQA4
This was selected as the best answer
Artur SchallerArtur Schaller
YES! Your formula worked. May I aske how you came up with that specific formula? And truthfully I don't fully understand on how to interprete that formula exactly :(.
Artur SchallerArtur Schaller
Also, thanks for the above resources!