Newer Version Available

This content describes an older version of this product. View Latest

run Commands (Retiring)

Commands to run a function.

On January 31, 2025, Salesforce will retire Salesforce Functions, also known as Salesforce Elastic Services. See Salesforce Functions Retirement for more information.

Important

run function

Send a cloudevent to a function.

Examples for run function

Run a function:

Run a function with a payload and a JSON response:

Flags

--json
Optional

Format output as json.

Type: boolean
-l | --function-url FUNCTION-URL
Optional

URL of the function to run.

Type: option
-H | --headers HEADERS
Optional

Set headers.

Type: option
-p | --payload PAYLOAD
Optional

Set the payload of the cloudevent as a JSON object or a path to a file via @file.json.

Type: option
-s | --structured
Optional

Set the cloudevent to be emitted as a structured JSON cloudevent.

Type: boolean
-o | --connected-org CONNECTED-ORG
Optional

Username or alias for the target org; overrides default target org.

Type: option

run function start

Build and run a Salesforce Function.

Description for run function start

Run this command from the directory of your Salesforce Functions project.

This command will run the target function locally (on the same operating system as this CLI), just like the `local` subcommand.

Examples for run function start

Build a function and start the invoker

Start the invoker with a specific language and port

Flags

-p | --port PORT
Optional

Port for running the function.

Type: option
Default value: 8080
-b | --debug-port DEBUG-PORT
Optional

Port for remote debugging.

Type: option
Default value: 9229
-l | --language LANGUAGE
Optional

The language that the function runs in.

Type: option
Permissible values are: auto, java, javascript, typescript
Default value: auto
-v | --verbose
Optional

Output additional logs.

Type: boolean

run function start local

Description for run function start local

Build and run a Salesforce Function locally.

Examples for run function start local

Build a function and start the invoker

Start the invoker with a specific language and port

Flags

-p | --port PORT
Optional

Port to bind the invoker to.

Type: option
Default value: 8080
-b | --debug-port DEBUG-PORT
Optional

Port to use for debugging the function.

Type: option
Default value: 9229
-l | --language LANGUAGE
Optional

The language in which the function is written.

Type: option
Permissible values are: auto, java, javascript, typescript
Default value: auto