Skip to content

Latest commit

 

History

History
89 lines (67 loc) · 2.02 KB

README.md

File metadata and controls

89 lines (67 loc) · 2.02 KB

CI Workflow Packaging Workflow codecov

PicklistUtils

Apex utility class for working with Picklists with built-in cache.

Click this link to install the PicklistUtils unlocked package in your org.

Reference:

  1. Working without record types
    1. Working with object and field references
    2. Working with object and field names as strings
  2. Working with record types
  3. Working with case statuses

Working without record types

Working with object and field references

List<Schema.PicklistEntry> getPicklistValues(
  sObjectType sObjectType,
  Schema.sObjectField field
)

Example:

List<Schema.PicklistEntry> entries = PicklistUtils.getPicklistValues(
  Account.sObjectType,
  Account.Industry
);

Working with object and field names as strings

List<Schema.PicklistEntry> getPicklistValues(
  String objectName,
  String fieldName
)

Example:

List<Schema.PicklistEntry> entries = PicklistUtils.getPicklistValues(
  'Account',
  'Industry'
);

Working with record types

PicklistEntries getPicklistValues(
  String objectName,
  Id recordTypeId,
  String fieldName
)

Example:

PicklistUtils.PicklistEntries entries = PicklistUtils.getPicklistValues(
  'CustomerRequest__c',
  '0124H000000cz6R',
  'Priority__c'
);

Working with case statuses

List<CaseStatus> getCaseStatusValues(
  Boolean isCaseClosed
)

Example:

List<CaseStatus> values = PicklistUtils.getCaseStatusValues(
  true
);