files

To return all attachments of a record as an array

In contrast to file() with this function, you can address all file attachments of a record, e.g. to send them as an attachment of an automatically generated e-mail or search for specific files in a table.

Syntax

files(nid)

Return

[file]

Examples

files(this)

Return: An array with all attachments of the current record.

count(files(this))

Return: 10 (If the current record has 10 attachments).

You (Steve Rogers) would like to send an email with the attachments of the current record to Hulk. This would be the script in the button within the record, that Steve would click to trigger the action.

sendEmail({
	from: "steve@avengers.com",
	to: "hulk@avengers.com",
	subject: "Importent documents",
	text: "Here come the important documents!",
	attachments: files(this)
})

Result: Hulk will receive an email with all the attachments of the current record.

See also

file, which returns a specific file based on the file name from a given record.

importFile, which imports a file from a URL and saves it as an attachment of a record.

Last updated