---
schema_version: "1"
id: 7e909c2e43e166beadb20c9bc1ee989872f90c757d2bc51cd9527278565c338c
title: Populating Picklist Values From Apex (Managed Package)
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/os_populating_picklist_values_from_apex.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.os_populating_picklist_values_from_apex.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 688e0d1fe429fbd39b73bf026de2b30f94bcb50cb14dd74106105f731d14ea3f
description: For the managed package runtime, you can populate Select, Multi-select, and Radio elements from an Apex class that implements Callable and Vlocity Open Interface. The values for the element are obtained during the Omniscript's activation.
products:
  - Omnistudio
release: "264"
---
# Populating Picklist Values From Apex (Managed Package)

For the managed package runtime, you can populate Select, Multi-select, and Radio elements from an Apex class that implements Callable and Vlocity Open Interface. The values for the element are obtained during the Omniscript's activation.

![Managed Package app icon](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-omnistudio_for_managed_packages-264-0-0-production-enus/aa2554ec-624a-4ee6-8da4-6435670e6e62/resources-global/_corporate/images/managedpackageicon.png) This information is for Omnistudio for Managed Packages. For Omnistudio on standard runtime, see [Omnistudio Help](https://help.salesforce.com/s/articleView?id=xcloud.os_omnistudio_standard.htm&language=en_US).

To populate a picklist from an Apex class, make sure to enable **Fetch Picklist Values at Script Load** for the Omniscript from Setup.

To populate the options of an element, a `List<Map<String, String>>` is returned from the Apex class. The Map Options are **Name**, the Language Independent Option, and **Value**, the UI Display value.

Sample Apex Code for Populating a Picklist:

```
global with sharing class SelectOptionsCallableAndVoi implements omnistudio.VlocityOpenInterface, Callable
{
    public Object call(String action, Map<String, Object> args) {
       Map<String, Object> input = (Map<String, Object>)args.get('input');
       Map<String, Object> output = (Map<String, Object>)args.get('output');
       Map<String, Object> options = (Map<String, Object>)args.get('options');
       return invokeMethod(action, input, output, options);
    }

    public Boolean invokeMethod(String methodName, Map<String,Object> inputMap, Map<String,Object> outMap, Map<String,Object> options)
    {
        try {
            if (methodName.equals('SelectOptions'))
            {
                SelectOptions(inputMap, outMap, options);
            }
        }
        catch(Exception e) {
            System.debug(LoggingLevel.ERROR, 'Exception: ' + e.getMessage() + ' ' + e.getStackTraceString());
        }
        return true;
    }
   
    private List<Map<String, Object>> SelectOptions(Map<String, Object> inputMap, Map<String, Object> outMap, Map<String, Object> options)
    {
        List<Map<String, Object>> optionList = new List<Map<String, Object>>();
        for (Account acc : [ Select Id, Name from Account limit 8])
        {
             Map<String, Object> option = new Map<String, Object>();
             option.put('name', acc.Id);
             option.put('value', acc.Name);
             optionList.add(option);
        }
        
        outMap.put('options', optionList);
                
        return optionList;
    }

}
```

For information on populating dependent picklists, see [Populating Dependent Picklist Values with Apex (Managed Package)](https://help.salesforce.com/s/articleView?id=xcloud.os_populating_dependent_picklist_values_with_apex.htm&release=264.0.0&type=5 "For the managed package runtime, you can populate Select, Multi-select, and Radio elements from a Callable implementation. The values for the element are obtained during the Omniscript's activation.").