+ Start a Discussion
SFDBadminSFDBadmin 

Help with workflow rule and formula

I am looking for help on achieving this scenario:

 

I have a field called position and it has a picklist of 6 choices of names

I have a field called chances and it has a picklist of 6 choices of numbers

 

I want to have the field chances change to a different number designated every time the field position changes.

 

Example:

When the field picklist for position changes to Named, the field for chances automatically changes to 70.

 

Thank you,

J

Best Answer chosen by Admin (Salesforce Developers) 
SteveMo__cSteveMo__c

There is no such thing as a Formula(Picklist) datatype.  To set a Picklist Value base on a condition in another field you need to use a Workflow Rule with a Workflow Action: Field Update. 

If the "Chances" picklist field doesn't have to be edited by the user, you can replace it with a Formula field, and then use the CASE formula the other users posted before.

All Answers

Ispita_NavatarIspita_Navatar

yes this can be achieved by using workflow rules.

Jeremy.NottinghJeremy.Nottingh

You can also do this with a custom formula field, as long as the chances field will always be calculated, and never edited directly.

 

A formula field wouldn't require fixing all your existing records, either, the way a workflow rule will. "Chances" would be definite as an Integer, and I think the formula would look something like:

 

 

CASE( position__c,
   "Named", 70,
   "Value2", 30,
   "Value3", 10,
/* ...other values here */
   0)

 

Jeremy

 

SFDBadminSFDBadmin

I used this formula and it does not work. Please help.

CASE( Bid_Level__c , "Named", 70, "Sole Sourced", 90, "Base Bid", 80, "Alternative Bid", 70, "Not Specified", 10)

SteveMo__cSteveMo__c

There is no such thing as a Formula(Picklist) datatype.  To set a Picklist Value base on a condition in another field you need to use a Workflow Rule with a Workflow Action: Field Update. 

If the "Chances" picklist field doesn't have to be edited by the user, you can replace it with a Formula field, and then use the CASE formula the other users posted before.

This was selected as the best answer
levi6dblevi6db

Add an else value at the end of the formula:

 

 

CASE( Bid_Level__c , "Named", 70, "Sole Sourced", 90, "Base Bid", 80, "Alternative Bid", 70, "Not Specified", 10, 0)

 

 

ChristineCGChristineCG

What if users do need to edit that picklist (so it can't be a formula field)?  Additionally, if there are 50 values set from a CASE statement, do you need 50 workflow rules?

SteveMo__cSteveMo__c

Hi ChristineCG, can you explin what you're trying do?  Like if the user does (blank) I want (blank) to happen...

ChristineCGChristineCG

Based on a CASE statement on the "Specialty" of an individual, I want to populate a Class Type.  The CASE reads:

CASE (Specialty,

"Surgery","1a",

"Dentistry","2a",

etc...for 100 lines.

 

The Class Type is populated with a value of "1a" or "2a", etc.

 

The Class Type field is a dropdown picklist.  I want to set the Class Type based on the value in this CASE statement.  It needs to be a dropdown because users have the ability to override the default and I don't want users mistyping the Class Types.

 

I appreciate any shortcuts you can provide rather than creating 100+ workflow rules.

SteveMo__cSteveMo__c

If you want 1 WFR you'll have to change Class Type to a TEXT field, otherwise I'm afraid I see writing a LOT of WFR's in your future... 

ChristineCGChristineCG

Thank you.  That is the sad realty I was afraid of.

Appreciate your comments.

SteveMo__cSteveMo__c

Sorry ChristineCG, I wish I had a better answer for you :-(