Skip to main content
73 votes
Accepted

How to query 'Value' of a picklist rather than the 'API NAME', using SOQL?

You can use toLabel() to convert the picklist api name to a label: SELECT toLabel(CUSTOM_PICK_LIST_COL__C) FROM OPPORTUNITY
John Towers's user avatar
  • 3,863
20 votes
Accepted

Custom setting Setting type not visible

You Can enable list custom setting schema Setting Page Setup > schema Setting Page > List custom Setting
Akshat's user avatar
  • 682
18 votes

Retrieve globalpicklist/globalvalueset without SOQL

Schema.DescribeFieldResult F = <Object_API_Name>.<Field_API_Name>.getDescribe(); Schema.sObjectField T = F.getSObjectField(); List<PicklistEntry> entries = T.getDescribe()....
Hari Enaganti's user avatar
18 votes

How to display Picklist Label, instead of Picklist API in a Formula Field

Unfortunately this feature does not seem to exist yet. Vote for this Idea: Allow Picklist Value Labels in Formulas Spring '17 brought "API Names" to picklist values so that integrations can ...
Adrian Larson's user avatar
  • 150k
16 votes

How do I get the intersection of RecordType and Picklist values inside Apex?

You can make use the User Interface API to get picklist values based on record type, https://developer.salesforce.com/docs/atlas.en-us.uiapi.meta/uiapi/ui_api_resources_picklist_values.htm However, ...
psun's user avatar
  • 371
13 votes
Accepted

How can we make ui:inputselect in lightning to dynamically get values from an object's picklist options?

You should create schema for the picklist and call this method from component using aura init. this will fetch picklist value on loading the component. public static List<String> getLeadStatus(...
Ajay Prakash Dubey's user avatar
13 votes
Accepted

Massive Spring '17 bug: SOQL returns wrong Custom Metadata Type picklist value

You can track this bug at https://success.salesforce.com/issues_view?id=a1p3A000000eshdQAA It's scheduled to be fixed in the next patch release. We've identified the exact set of circumstances that ...
Avrom Roy-Faderman's user avatar
13 votes
Accepted

Picklist API name in Formulas

Formula fields already see the API name and only the API name (yes, even TEXT(fieldName) gets you the API name, not the label). There is currently no way to fetch the label instead from a formula ...
Charles T's user avatar
  • 11k
13 votes
Accepted

Metadata API error while reading Picklist: Web service callout failed: Unable to find apex schema info

This is a very similar scenario to what is occurring in Tooling API in Apex - polymorphism, generic query() callout? and is caused by an underlying limitation in Wsdl2Apex and WebServiceCallout.invoke(...
Daniel Ballinger's user avatar
12 votes
Accepted

I have a managed package, if I add values a picklist, will my customers get it on an upgrade?

Unfortunately, not. We tried to support this scenario in Winter '18, as correctly stated in the release notes document posted above, but we had to revert that change and pull it from the release. ...
Vladimir Gerasimov's user avatar
11 votes
Accepted

Replacing the Picklist old values into new values?

No, workflow rules, triggers, validation rules, flows, Process Builders, and any other logic that would run on a normal DML operation will not run as a result of using Replace.
sfdcfox's user avatar
  • 491k
11 votes
Accepted

Error: “Picklist value in picklist not found” Opportunity Stage - Sales Process

you need to include StandardValueSet to your package.xml. to deploy custom values to Opportunity.StageName field use next lines: <types> <members>OpportunityStage</members> ...
Oleksandr Berehovskyi's user avatar
11 votes

Metadata API error while reading Picklist: Web service callout failed: Unable to find apex schema info

Taken from Issue # 225 on their repo. Error occurred when obtaining a custom picklist fields CustomValue. Error: System.CalloutException: Web service callout failed: Unable to find apex schema ...
battery.cord's user avatar
  • 8,825
11 votes
Accepted

How to reference Choice Value in formula instead of its label?

For whatever reason, as noted here, you seem to get the label if you refer to the field, but you get the value if you pass the field into a record element/variable. As @Mitesh stated, you should be ...
Kris Goncalves's user avatar
10 votes

Converting an Existing Picklist to Use Global Picklist

There is no way to convert existing pick list to use global pick list. While modifying any pick list on user interface we are not given any option to choose global pick list. I explored the metadata ...
Mukesh Verma's user avatar
  • 1,916
10 votes

How to query 'Value' of a picklist rather than the 'API NAME', using SOQL?

You don't need to use SOQL to do this, instead you can get it using Apex's Schema utility and DescribeFieldResult class. For example: public List<String> myPicklist { get { if (...
Dan Jones's user avatar
  • 7,187
10 votes
Accepted

Custom options added to Standard Value Set picklist are not included into managed package

No, you can't package any standard fields, including standard value sets. Only this list of components is available for packaging.
sfdcfox's user avatar
  • 491k
10 votes

Get custom Picklist value in LWC without Record Type

Use the "null" record type Id, "012000000000000AAA" as the record type Id. @wire(getPicklistValues, { objectApiName: PRICEBOOK_OBJECT, recordTypeId: '012000000000000AAA'}) This is ...
sfdcfox's user avatar
  • 491k
9 votes
Accepted

How can I ensure that a field is blank for some account types, and mandatory for others?

You should be able to piece this one together. Here are the functions you'll need: OR(logical1, logical2...) and replace any number of logical references with the expressions you want evaluated. AND(...
Adrian Larson's user avatar
  • 150k
9 votes
Accepted

Retrieve globalpicklist/globalvalueset without SOQL

My strategy here would simply be to describe a picklist field that implements the Global Picklist. SObjectField picklistUsingGlobal = SObjectType.MyObject__c.fields.PicklistUsingGlobal__c....
Adrian Larson's user avatar
  • 150k
9 votes
Accepted

Formula Field - Case Function

If function will work inside the case statement in formula You can do like this:- CASE( sa_nket__case_text__c , '00', 'Member', '02', 'Member', '03', 'Member', '99', 'Member', '23', IF( ISBLANK(...
sanket kumar's user avatar
  • 15.3k
9 votes
Accepted

How can I query the supported timezones in Apex?

If you call TimeZone.getTimeZone with an invalid SID you get back the "GMT" time zone instance - this is one way to validate that your SID is supported (by checking that the SID for the object you get ...
Phil W's user avatar
  • 36.2k
9 votes
Accepted

How to identify in Apex what picklist fields are restricted

The isRestrictedPicklist() method, documented at the link in your question, is what you're looking for.
Thomas Taylor's user avatar
8 votes
Accepted

Adding/defaulting a null value to a selectlist on a Visualforce page

I usually just do this. Class: public List <SelectOption> getisNDA() { List<SelectOption> options3 = new List<SelectOption>{ new SelectOption('','-Select-') }; ...
Andrew L.'s user avatar
  • 837
8 votes

ANT deployment of custom field fails - Error: Property 'picklist' not valid in version 39.0

I think from 37 Api ver picklists are replaced with Valuesets in metadata definitions and it causes an error when You try to deploy 'old' metadata with higher Api Version. To get rid of this error, ...
patryk's user avatar
  • 655
8 votes
Accepted

soql picklist toLabel apex

You can access it by sobject get method like: fieldSet.get('labelType') and you can select both label and picklistvalue in single query.
Pragati Jain's user avatar
  • 1,570
8 votes

Picklists validFor attribute

DescribeSObjectResult describes how validFor operates. It is decoded into a series of bits (base-64 encoded) where each bit is set to 0 if not valid, 1 if it is. In your example, AAAI decodes to: ...
sfdcfox's user avatar
  • 491k
8 votes
Accepted

How do I create a Lightning web component that shows all the custom list views of an object?

Take a look into the lightning/uiListApi module. It has below functionality - Get list view records and metadata for a list view by API name import { LightningElement, wire } from 'lwc'; import {...
Mohith Shrivastava's user avatar
7 votes

Picklists not Supported in SOQL WHERE Clause (External Objects)

I suspect this might be down to how they're implemented on the external system itself. The where part of the query is not handled by Salesforce, but by the OData compliant API at the other end, the ...
Matt Lacey's user avatar
  • 25.6k
7 votes

Get list of unused picklist options

The easiest way to do this is actually just to edit the field twice: change the field type to text, then change it back to picklist. During the text to picklist conversion, all actual values in the ...
sfdcfox's user avatar
  • 491k

Only top scored, non community-wiki answers of a minimum length are eligible