1

I Have Created a New Custom Formula Field called Locale in Case Object,I want to Extract all Values which is available on User object(Locale Field Value) to case Locale Field, How ? Can anyone Explain to this Question.

1 Answer 1

3

You can get the values available in the User object Locale field in Apex using:

for (PicklistEntry pe : User.LocaleSidKey.getDescribe().getPicklistValues()) {
    system.debug(pe.getValue() + ' ' + pe.getLabel());
}

The labels and underlying values are different.

You could certainly add the labels - output using some variation of the code - as a picklist field on Case.

5
  • I dont want apexclass,i want with the help of Formula Field or Validation Rule or is there any Method to Extract Values on Localesid Key Value for Case Object
    – user31717
    May 26, 2016 at 14:35
  • Have anyone Answer for Me
    – user31717
    May 26, 2016 at 14:48
  • If i Get Value through the Apex Class,then how to update the Value in Case Custom Field Locale
    – user31717
    May 26, 2016 at 14:49
  • I'm suggesting you add a picklist field to Case and set the possible values based on the output of code similar to the code I posted run using "execute anonymous". But that will leave you with a string on Case that is the label not the code value so you won't be able to directly compare that with the User. LocaleSidKey field. Suggest you expand your question with exactly what you want to do with the Case field.
    – Keith C
    May 26, 2016 at 15:24
  • I have Created the in case custom Field called Locale,whenever the case Locale should be equal to user Locale,case Record Owner should be changed to Particular user,using case assignment Rule
    – user31717
    May 27, 2016 at 6:15

You must log in to answer this question.