Case function examp...
 
Notifications
Clear all

[Solved] Case function example in salesforce formula with picklist

2 Posts
1 Users
0 Likes
238 Views
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

How to use Case function in salesforce formula with picklist

Issue Tags
1 Reply
Posts: 205
 CWL
Admin
Issue starter
(@cwl)
Member
Joined: 11 years ago

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
  )
)

Refer Salesforce help

Reply
Share: