Case Function
Category: | Logical |
Description: | Checks an expression against a series of values. If the expression compared is equal to any value, the corresponding result is returned. If it is not equal to any of the values, the else-result is returned |
Parameters: | |
expression as Object | Field or reference to a field of an object |
value1/elseResult as Object | Represents the value of the field specified in the "Expression" parameter, while "Else Result" represents the action if the previous value is not equal to "TRUE" |
result1 as Object | Represents the resulting action if "value1" is equal to true |
value2/elseResult as Object | Represents the second potential value of the field specified in the "Expression" parameter, while "Else Result" represents the action if the previous value is not equal to "TRUE" |
... as Object | You can enter multiple "Values/Else Results" or "Results" in the same manner as described above |
Returned value as Object | |
Example #1 |
Setting the due date of an issue to be based off of its severity. In this scenario, the response time for a critical issue is set to 1 working day, 3 working days for a high severity, and 5 working days for all other severity levels. Case(ToString($Severity),"Critical",DateAdd($CreatedOn,Days(1,TRUE)), "High", DateAdd($CreatedOn,Days(3,TRUE)), DateAdd($CreatedOn,Days(5,TRUE))) |
Example #2 |
Creating a workflow rule that automatically sets a project sponsor based on the project type> Case(ToString($ProjectType),"Development","Username1","Advertising","Username2",$ProjectSponsor) |
Example #3 |
Creating a workflow rule that extracts the month and the quarter from a given due date field Case(ToString(Month($DueDate)),"1","Q1-Jan","2","Q1-Feb","3","Q1-Mar", "4","Q2-Apr","5", "Q2-May", "6", "Q2-Jun","7", "Q3-Jul","8", "Q3-Aug", "9", "Q3-Sep", "10", "Q4-Oct", "11", "Q4-Nov", "Q4-Dec") |
Tips |
|
Related Functions | |
Additional Links |