Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pozil/picklist-utils
Apex utility class for working with Picklists with built-in cache
https://github.com/pozil/picklist-utils
apex api dynamic picklist ui
Last synced: 23 days ago
JSON representation
Apex utility class for working with Picklists with built-in cache
- Host: GitHub
- URL: https://github.com/pozil/picklist-utils
- Owner: pozil
- Created: 2021-05-10T08:25:41.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-06-01T11:56:50.000Z (over 1 year ago)
- Last Synced: 2024-11-19T06:00:50.039Z (3 months ago)
- Topics: apex, api, dynamic, picklist, ui
- Language: Apex
- Homepage:
- Size: 249 KB
- Stars: 20
- Watchers: 2
- Forks: 10
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[![CI Workflow](https://github.com/pozil/picklist-utils/workflows/CI/badge.svg)](https://github.com/pozil/picklist-utils/actions?query=workflow%3ACI) [![Packaging Workflow](https://github.com/pozil/picklist-utils/workflows/Packaging/badge.svg)](https://github.com/pozil/picklist-utils/actions?query=workflow%3APackaging) [![codecov](https://codecov.io/gh/pozil/picklist-utils/branch/main/graph/badge.svg)](https://codecov.io/gh/pozil/picklist-utils)
# PicklistUtils
Apex utility class for working with Picklists with built-in cache.
Click [this link](https://login.salesforce.com/packaging/installPackage.apexp?p0=04t5e000000MIe8AAG) to install the PicklistUtils unlocked package in your org.
Reference:
1. [Working without record types](#working-without-record-types)
1. Working with object and field references
1. Working with object and field names as strings
1. [Working with record types](#working-with-record-types)
1. [Working with case statuses](#working-with-case-statuses)## Working without record types
### Working with object and field references
```
List getPicklistValues(
sObjectType sObjectType,
Schema.sObjectField field
)
```Example:
```
List entries = PicklistUtils.getPicklistValues(
Account.sObjectType,
Account.Industry
);
```### Working with object and field names as strings
```
List getPicklistValues(
String objectName,
String fieldName
)
```Example:
```
List 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 getCaseStatusValues(
Boolean isCaseClosed
)
```Example:
```
List values = PicklistUtils.getCaseStatusValues(
true
);
```