Type "multiselect"

If your function implementation needs to make multiple selections from a group of statics options, you can use environment variables of type multiselect in your implementation. Then our platform will ask consumers to enter their value during installation.‌

The type multiselect variables allow the consumers of a function to select multiple elements between a list of options, which you need to define using the options prop. This type is displayed in the installation UI form as a checkbox group element (see image below).

Example of a type "multiselect" environment variable definition

"env": [
    {
        "name": "PAYMENT_METHOD",
        "description": "The payment methods that the customer can use to make payments.",
        "required": true,
        "type": "multislect",
        "options": [
            "card",
            "cash",
            "invoice",
            "external"
        ],
        "default": [
            "cash",
            "invoice"
        ]
    }
]

Example of how to consume the value of the environment variable within the function implementation

const myFunction = () => {
    const paymentMethod = JSON.parse(process.env.PAYMENT_METHOD)
    ...
};

module.exports = myFunction;

Properties of the type

property

type

required

default

description

name

string

yes

-

The name of the environment variable. This should be unique for each variable.

description

string

no

-

The description of the environment variable.

default

array

no

-

The default values for the variable.

required

bool

no

false

Specifies that a variable must be filled out before submitting.

options

array

yes

-

The options will define the env values for the select. Each option value should be unique inside the array.

Last updated