+ Start a Discussion

Auto Populate Field Based on Custom Pick-List Selection

Newbie to this but I am trying to create a custom formula for a user defined field that will auto-populate with a text value based on a user defined pick-list selection.
Can anyone help...I have not been able to find anything in the help or internet for this.

ex....Region 17 is selected from the Region field; NAME is populated in the Region Manager Field.

You should be able to use a CASE function
to populate a text  formula field.  Something like:
CASE(picklist field__c,
Region 17, "Name",
Region 18, "Name 2",
Search Help for Case Function.
Thanks I will give it a try; I am not doing well with these formulas, need to get some training on these desperately!
Thanks for the help, you are a lifesaver.  This is a huge piece of the system for us and it made managing it much easier..thanks again!
I was sure that your answer would cure my issue.
I have a picklist field called Region with values of EAST and WEST.
I am trying to have the value of the Region auto-populate a Location formula text field.
I am using the following to create the Location field:

CASE ( Region__c , EAST, "Building 1" , Region__c  WEST, "Building 2", "None")

also tried:

CASE( ISPICKVAL(Region__c ,EAST, "Building 1" , Region__c , WEST, "Building 2")

Both are returning errors - do you see what I am missing?
I appreciate any help you can provide.


Hi Autochic,

Have you thought about making a dependant picklist? That sounds like it would handle your needs really well - you create a second picklist which has choices like Building 1, Building 2 and then make it dependant on the Region picklist so that if East is selected, Building 1 is the only option.

Anyway, if that doesn't work for you then you'll need to write a lot more code than what you've got so far. You've got the right general idea, but you need to repeat the sections. I'm not great with code, but the basic idea would be

if(ispickval(Region__c, "East"), "Building 1",
   if(ispickval(Region__c, "West"), "Building 2","None"

 Good luck!



Here is what I used and it works like a charm, make sure it follows this format and you should be golden:

CASE( RSM_Sub_Region__c,
"1-North East", "NAME",
"2-Mid East", "NAME",
"3-South East", "NAME",

I used the IFCASE value based on a suggestion.  Hope this works.
Thanks so much for the quick response, Jake!
I was going to go the route of dependent picklist, however my needs are somewhat more complex. The field needs to be auto-populated. As far as I see, the dependent picklist would still need to be manually selected, as it has more than one value and cannot be set to default.
So... I still need to figure out the formula
Awesome! I thought for sure I had read a while back that you couldn't use the case statement with picklists like that, but I just double-checked it myself and it works beautifully. Thanks so much!
How about if you want that exact pick-list value in your custom field. For example you have an user object with the picklist field "division" (or something like that) and you want this same division to be visible in the opportunity this user creates.

Hi Khalid,

If you just want a field from another object to display on an object I think what you want to do is make an S-Control. Then, as long as there's a clear relationship between the objects, I think it's basically just referencing the field. For example, {!Account.Division}. Ironically, that's the easy part - the hard part is getting it to look like it belongs on the form.

For example, here's the code that I use to display the 18 digit asset ID:

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 


<style type="text/css"> 
body, td {margin:0px; color:#333;} 
body {background-repeat: repeat-x; background-position: left top; font-size: 75%; font-family: 'Arial', 'Helvetica', sans-serif; background-color: #F3F3EC;} 
a {color:#333;} 
a:hover {text-decoration:underline;} 
th {text-align: left; font-weight: bold; white-space: nowrap;} 
form {margin:0px; padding:0px;} 
h1, h2, h3, h4, h5, h6 {font-family: "Verdana", "Geneva", sans-serif; font-size: 100%; margin:0px; display:inline;} 
.titleSeparatingColon {display: none;} 
.bPageBlock {width:100%;} 
.bPageBlock .pbSubheader {background-color:#222; color:#FFF; font-weight:bold; font-size: 91%; padding:2px 2px 2px 5px; margin-top: 3px; overflow: hidden; margin-bottom: 2px;} 
.bPageBlock .pbBody {background-color:#F3F3EC;} 
.bPageBlock .detailList {width:100%;} 
.bPageBlock .detailList th, .bPageBlock .detailList td {vertical-align:top;} 
.bPageBlock .labelCol {padding:2px 10px 2px 2px; text-align:right; font-size: 91%; font-weight: bold; color:#333;} 
.bPageBlock .detailList .labelCol {width: 18%;} 
.bPageBlock .dataCol {padding:2px 2px 2px 10px; text-align:left;} 
.bPageBlock .detailList .dataCol {width:32%;} 
.bPageBlock .detailList .data2Col {padding: 2px 2px 2px 10px; text-align: left; width: 82%;} 
.bEditBlock .detailList .dataCol, .bEditBlock .detailList .data2Col {padding: 0 2px 0 10px;} 
.bPageBlock .detailList .col02 {border-right: 20px solid #F3F3EC;} 
.bPageBlock .detailList tr td, .bPageBlock .detailList tr th {border-bottom:none;} 
.editPage .bPageBlock .detailList tr td, .editPage .bPageBlock .detailList tr th {border-bottom: none;} 
.bPageBlock .detailList th.last, .bPageBlock .detailList td.last, .bPageBlock.bLayoutBlock .detailList tr td, .bPageBlock.bLayoutBlock .detailList tr th {border-bottom:none;} 
.bPageBlock .detailList table td, .bPageBlock .detailList table th {border-bottom-style: none;} 
.lead .tertiaryPalette {background-color: #EBAF59; border-color: #EBAF59;} 
<body class="lead"> 
<div class="bPageBlock"> 
<div class="pbBody"> 
<div class="pbSubsection"> 
<table class="detailList" border="0" cellpadding="0" cellspacing="0"> 
<td class="labelCol">Asset ID</td> 
<td class="dataCol col02"><script type="text/javascript"> 
function normaliseSforceID( id) { // fluff up a 15 char id to return an 18 char id 
if (id == null) return id; 
id = id.replace(/\"/g, ''); // scrub quotes from this id 
if (id.length != 15) { 
//print('well, id is not 15, bye' + id + ' ' + id.length); 
return null; 
var suffix = ""; 
for (var i = 0; i < 3; i++) { 
var flags = 0; 
for (var j = 0; j < 5; j++) { 
var c = id.charAt(i * 5 + j); 
if (c >= 'A' && c <= 'Z') { 
flags += 1 << j; 
if (flags <= 25) { 
suffix += "ABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(flags); 
} else { 
suffix += "012345".charAt(flags-26); 
return id + suffix; 


Thanks for the info,
Is it a problem that the source field is a pick-list because I continuously get the Error: Field Division__c is a picklist field. Use it with an ISPICKVAL() or CASE() function instead.

thanks so much for sharing your solution!