See: Description
Interface | Description |
---|---|
Picklist |
This interface provides information about a picklist.
|
PicklistService |
Service to retrieve picklist information.
|
PicklistValue |
This interface provides access to picklist values to retrieve
picklist labels and determine if a picklist value is active.
|
Picklist field types are defined as a single-value or multi-valued field. A picklist field stores the name of each picklist value, and each name has a corresponding UI label.
The following example illustrates retrieving a single-value picklist field name and label:
PicklistService picklistService = ServiceLocator.locate(PicklistService.class);
Picklist authorityPicklist = picklistService.getPicklist("authority__c");
List picklistValues = inputRecord.getNew().getValue("authority__c", ValueType.PICKLIST_VALUES);
if (picklistValues != null && !picklistValues.isEmpty()) {
//Get single-picklist value name selected by user
String authorityPicklistValueName = picklistValues.get(0).toString();
//Get picklist value label
String authorityPicklistValueLabel =
authorityPicklist.getPicklistValue(authorityPicklistValueName).getLabel();
//Default name__v field with picklist value label
inputRecord.getNew().setValue("name__v", "Auth: " + authorityPicklistValueLabel);
}
Copyright © Veeva Systems 2017–2019. All rights reserved.