Open Files
lightning:openFiles
The lightning:openFiles event is no longer recommended. Use the Lightning navigation service instead. Application event used to open one or more file records. This event triggers a modal file previewer or download depending on the form factor.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App
lightning:openFiles is an application event used to open one or more file records.
Firing the event opens the preview of a single or multiple files in a modal dialog when on desktop, or trigger a file download on mobile devices.
The desktop file previewer offers image and SVG-based multi page office documents preview, presentation mode and quick access to file actions (share, download, upload, delete).
On mobile and tablet a single file is downloaded when the event is fired i.e. the one specified in selectedRecordId or the first element from the recordIds list. Depending on the device this triggers a native preview of the file.
Supported entities are ContentDocument and ContentHubItem (external files).
The lightning:openFiles event is supported in Lightning Experience, the Salesforce mobile app, and Experience Builder sites based on the Customer Service template.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
recordIds | IDs of the records to open. | string | ![]() | |
selectedRecordId | ID of the record to open first among the one specified in the recordIds attribute. If this value is not provided or if the value provided is not in the list, the first element from the list will be used. | string |
