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
David OvellaDavid Ovella 

How can I automatically save a value depending of the user.name?

I have a picklist call "branch" with 8 values in it and is use for 8 users.
And I want to know:
For example, if I am user: "Maker Villa Morra" I want my picklist save the value automatically "Maker vm", or
if I am user: "Maker Centro" my picklist save "Maker vm"
depending of the user name... how can I do that?
 
Best Answer chosen by David Ovella
Raghu_CloudRaghu_Cloud
Hi David, 

You can use a formula field to return as a text. Then, you can use the case function and expression as $User.Firstname or $User.LastName values are the first or last names and the results are your "Maker vm" or "Maker Cm" depending on the user. 
Formula : 
 CASE( $User.FirstName , FirstName1, Result1, FirstName2, Result2,else_result). 
The else_result can be anything as you will not be entering that part of the formula (considering all the first or last names you give are correct and in the org). 

Thanks. 

All Answers

Robert ZentgrafRobert Zentgraf
Hi David,

you can use a text field instead of the picklist, or? So you are able to update the textfield by using a workflow.

Regards
Robert
(mindforce: http://www.mind-force.de)
Raghu_CloudRaghu_Cloud
Hi David, 

You can use a formula field to return as a text. Then, you can use the case function and expression as $User.Firstname or $User.LastName values are the first or last names and the results are your "Maker vm" or "Maker Cm" depending on the user. 
Formula : 
 CASE( $User.FirstName , FirstName1, Result1, FirstName2, Result2,else_result). 
The else_result can be anything as you will not be entering that part of the formula (considering all the first or last names you give are correct and in the org). 

Thanks. 
This was selected as the best answer