Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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
);
```