0

I want to create a Workflow and update the field based on PICKLIST Value

Picklist Field (Currency) & Value is -> A B, C, D

like if (Currency = 'A')

amount = Service* 10;       

else

like if (Currency = 'B')

amount = Service* 20;

else

like if (Currency = 'C')

amount = Service* 40;

else

like if (Currency = 'D')

amount = Service* 40;

else

amount = nuLL

1 Answer 1

0

Goto setup --> Create --> Workflow & Approvals --> Workflow Rules --> New Rule

Click on New Rules Select Object

Give any name for workflow rule enter image description here and select created, and any time it’s edited to subsequently meet criteria and set your criteria.

Click on save. Now set up a field update. Click on add Workflow action --> New Field Update.

enter image description here

Now fill the name and select which field in Field to Update dropdown

In Formula Value (Text) = Write below code

 IF(ISPICKVAL(Currency , 'A'),  Service* 10,
        IF(ISPICKVAL(Currency , 'B') ,Service* 20,
            IF(ISPICKVAL(Currency , 'C') ,Service* 40, 
              IF(ISPICKVAL(Currency , 'D') ,Service* 40, 
                0
              )
            )
        )
    )

Write this code in Workflow field update.


Another answer with Case statement

CASE(Currency ,
       'A', Service* 10,
       'B', Service* 20,
       'C', Service* 20,
       'D', Service* 40,
       0
)
4
  • what need to add in the WF rule while configuring it?
    – Nandu Raja
    Commented Nov 27, 2015 at 9:39
  • you can add created, and any time it’s edited to subsequently meet criteria
    – Ratan Paul
    Commented Nov 27, 2015 at 10:02
  • @SachinKumar check my updated ans.
    – Ratan Paul
    Commented Nov 27, 2015 at 10:51
  • 1
    CASE is a bit cleaner especially if the number of conditions grows over time. Fewer parens as well making it easier to edit
    – cropredy
    Commented Nov 27, 2015 at 15:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .