function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
baller4life7baller4life7 

PICKLIST with different VALUE than CAPTION

The custom field type "Picklist" saves its values as Strings. How can I save number values into the database, but having String captions for the picklist?

 

For example:

 

The picklist has the following captions:

 

"Worse"

"Bad"

"Good"

"Better"

 

When the user picks "Worse" I want the custom field to be saved as 1 into the database, when he picks "Bad" it should be saved as 2, and so on...

Best Answer chosen by Admin (Salesforce Developers) 
TrimbleAgTrimbleAg

Your going to need another formula field in the back ground and asign a value to each option in the formula.. Something like...

 

if(pickval="Worse"),1

 

Thats not the whole code, but you get the point.

 

Thanks,

PB

 

 

All Answers

TrimbleAgTrimbleAg

Your going to need another formula field in the back ground and asign a value to each option in the formula.. Something like...

 

if(pickval="Worse"),1

 

Thats not the whole code, but you get the point.

 

Thanks,

PB

 

 

This was selected as the best answer
baller4life7baller4life7

This kind of solution works for so many cases... Just add another field!

Shame on me that I didn't hit on that idea myself.

 

Thank you very much!

Josh