Skip to main content
Add the Box File Picker to your own Agentforce action so users pick a Box file in the action input instead of pasting file IDs. Two packaged pieces make it work:
  • FileSelection — global Apex type with selectedFileId / selectedFileName. The value the picker returns.
  • boxFileSelection — Lightning Type that renders the boxFilePicker UI (Recent Items / Browse Box Files / Current Record Folder).
Both ship in the package — you don’t build them.

Namespace (subscriber orgs)

Everything is under the boxagents namespace. In a subscriber org, reference packaged components with the prefix — the bare names won’t compile: Using bare FileSelection causes Invalid type: FileSelection / InvocableVariable fields do not support type … / Variable does not exist: req.file.

Steps

  1. Add a boxagents.FileSelection @InvocableVariable to your Request.
  2. Read req.file.selectedFileId (and selectedFileName).
  3. In Agent Builder, map that input to the boxagents__boxFileSelection Lightning Type so the picker UI renders.
Example

Mapping the input in Agent assets

Mapping input agent assets The Apex input lets the action accept a selection; mapping it to the Lightning Type makes the picker UI render:
  1. Open your custom action (Agentforce Studio → Agent Actions, or Flow Builder).
  2. Select the Select File input.
  3. Set its reference / Lightning Type to boxagents__boxFileSelection (Box File Picker).
  4. Save and activate.

Notes

  • Namespace prefix in subscriber orgs is the #1 source of errors.
  • Null-check req.file / req.file.selectedFileId.
  • The ID is what Box APIs need; the name is for display/logging.
  • Full references: the shipped BoxAIAskWithFilePicker, BoxAIGenTextWithFilePicker, BoxAIExtractFieldsWithFilePicker, BoxAIExtractMetadataWithFilePicker.
Last modified on August 3, 2026