Notifications
Clear all
Nov 03, 2022 12:08 pm
How to use Case function in salesforce formula with picklist
1 Reply
Nov 03, 2022 12:12 pm
Case function syntax:
CASE( [expression], [test value 1], [result 1], [test value 2], [result 2], ... [test value n], [result n], [default result] )
You don't need to use ISPICKVAL() if your CASE() function is operating on a picklist field. Example:
IF( ISPICKVAL(Primary_Account_User_Target_Line_Item__r.CurrencyIsoCode, "INR"), CASE( CurrencyIsoCode, "INR", Amount, "USD", Amount * VALUE($Label.Exchange_Rate_INR), "MYR", Amount / CURRENCYRATE("MYR"), "EUR", Amount / CURRENCYRATE("EUR"), 0 ), IF( ISPICKVAL(Primary_Account_User_Target_Line_Item__r.CurrencyIsoCode, "USD"), CASE( CurrencyIsoCode, "INR", Amount, "USD", Amount, "MYR", Amount / CURRENCYRATE("MYR"), "EUR", Amount / CURRENCYRATE("EUR"), 0 ), 0 ) )