---
schema_version: "1"
id: f61e9d38d6bc5479468d839336c19318b83902219fed1946cf836c13f444275e
title: Value Providers
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/connector-builder/value-providers.md
canonical_url: https://docs.mulesoft.com/connector-builder/value-providers
source_site: docs.mulesoft.com
content_type: documentation
content_hash: 2c181e9d5bb5c7d9a63a510d68e91a7e077c120e3ed9d9dac257c78c3ef131d8
description: MuleSoft Documentation Site
latest: true
---
---
product: Connector Builder
version: master
---

# Value Providers

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Learn how to define value providers for your connector. Value providers are functions that show a
list of valid options for a given field. This enhances the user experience by presenting selectable
choices instead of requiring users to remember or manually enter valid values. For example, you can
define a value provider to show a list of ISO country codes.

Connector Builder supports:

- Static value providers (String enums, Numeric enums)

- Dynamic value providers

- Value provider pagination

## Define Value Providers Using LinkWeave

Attaching value providers to types allows the platform to automatically retrieve and display
possible values for fields that use those types.

For example, suppose you have a connector with an operation that retrieves the population for a
given country:

```none
var getPopulation : Operation<{country: CountryIsoCode}> = {
    // ...
}
```

Here, the `country` parameter expects an ISO country code (for example, `AR`, `US`, or `BR`).
Instead of asking users to remember these codes, you can define a value provider to supply the list
of valid countries.

1.  Define an operation to fetch the list of countries:

    ```none
    var getCountries = // ...
    ```

2.  Create the value provider using `defineValueProvider`. This function takes two arguments: the
    executor for fetching the data, and a transformation function to map the response to the
    required format:

    ```none
    var countriesValueProvider = defineValueProvider(
        getCountries.executor,
        (response: HttpResponse<{items: Array<Country>}>) ->
            response.body.items map ((item, index) -> {
                value: item.isoCode,
                displayValue: { label: item.name }
            })
    )
    ```

    The transformation function must return an array of objects with this structure:

    ```none
    {
        value: VALUE, // The actual value to be used as input
        displayValue: {
            label: LABEL // The label shown to the user for this value
        }
    }
    ```

3.  Add the value provider to your connector declaration:

    ```none
    @FlowConnectorElement()
    var connector = {
        name: "WorldInfo",
        // ...
        operations: {
            getPopulation: getPopulation,
            getCountries: getCountries
        },
        valueProviders: {
            countriesValueProvider: countriesValueProvider
        }
    }
    ```

    Now, the value provider can be referenced by any operation that requires a country input.

4.  Annotate the parameter in your operation to use the value provider:

    ```none
    var getPopulation : Operation<{country: @ValuesFrom(value = { name: countriesValueProvider }) CountryIsoCode}> = {
        // ...
    }
    ```

    With this setup, users see a dropdown of country names when selecting a country, and the
    corresponding ISO code is used as the input value.
