ISPICKVAL(Type, "Other") && ISBLANK(Other_Type__c)
This formula would be used in a validation rule. ISPICKVAL() checks whether the value of the picklist Type is “Other”. And returns true if it is. Furthermore, ISBLANK() checks whether the field is blank. If both of these cases are true then it would send an error message.
ISPICKVAL, CASE, and TEXT all take picklist values as arguments.
NOT(ISPICKVAL(PRIORVALUE(Type), "")) && ISPICKVAL(Type, "")
The above formula utilises ISPICKVAL and PRIORVALUE to check if the prior value of picklist field is blank. And also whether the current value is blank. In this way, we can check if it’s blank now but it wasn’t blank before.
CASE(Type, "Electrical", 1, "Electronic", 2, "Mechanical", 3, "Structural", 4, "Other", 5, 5)
The above formula returns a value for the given picklist values, as well as an “else” default.
"This case is " & TEXT(Status)
Use TEXT() to convert the picklist value to a string.
You can then use this TEXT() function in conjunction with BEGINS() or CONTAINS().
*Multiselect picklists are not recommended in formulas. And you can’t use TEXT with them.
AND( ISPICKVAL(Status, "Escalated"), ISBLANK(Reason_for_Escalating__c) )
The above formula is used in a validation rule. It requires users to fill out the Reason for Escalating field if the picklist value Status is set to Escalated. Below that is the error message.
CASE(Account.Rating, "Hot", 1, "Warm", IF(Is_Executive__c, 1, 2), "Cold", IF(Is_Executive__c, 2, 3), 3)
The above formula utilises both the CASE and IF functions to assign priority levels based on the values of two different fields. If it’s hot then it’s always priority 1. If it’s warm it’s priority 1 if they’re an executive, else it’s priority 2. If it’s cold and they’re an executive it’s priority 2. Otherwise, it’s priority 3.
IF(ISPICKVAL(Contract_Status__c, "Activated"), TODAY() - Contract_Activated_Date__c, null)
This returns the number of days since the contract was activated if it is activated. Otherwise it returns null.
IF(AND(Payment_Due_Date__c < TODAY(), ISPICKVAL(Payment_Status__c, "UNPAID")), "Payment overdue!", null)
This returns “Payment overdue!” if the payment due date is earlier than today and the payment status is “unpaid”.
ISPICKVAL(Status, "Open - Not Contacted") && BEGINS(TEXT(PRIORVALUE(Status)), "Closed")
If the picklist status in value “open – not contacted” and the prior value of the status field began with “closed”, then this will return true.
IsEscalated=TRUE && (NOT(ISPICKVAL(Priority, "High"))) || (ISPICKVAL (Status, "Closed")) || (IsClosedOnCreate=True)
I used the above formula to pass the Trailhead challenge. I’m not sure where IsEscalated comes from, is that literally a checkbox? Seems so. So if that is checked and priority is not high, or status is not closed, or IsClosedOnCreate is checked. Then it will send the error message. Not sure what some of these fields are.