Skip to content

Remove File – deleting a stored file from an action

The command "Remove File" deletes a file from a file storage (Azure Blob Storage or S3). This page is for administrators who build actions that clean up attachments or replace a document by a new version.


1. At a glance

Purpose Delete a stored file by its ID
Typical use Remove an outdated document before a new one is added; clean up files of a record
Where in the editor Toolbar menu "Files" → "Remove File"
Needs a user interface No
Needs a current record Yes
Related Get Files, Add File

The file is gone afterwards. nexxcite has no recycle bin for files; only a backup of the storage brings it back.


2. Settings

The settings are on the tab "Settings". "Display Name", "Description" and "Execution Condition" are on the tab "General" (see Actions).

Setting Meaning Default / Required
"File Provider" The kind of storage: "Azure Blob Storage" or "S3 Storage" Required
"Credentials" The credentials of the storage, of the kind that matches the file provider Required
"File Id" Expression for the ID of the file – for example the Id of an entry of the list that Get Files writes Required
"Save" Saves the record right after the file was marked for deletion Off

3. Behaviour

  1. Without a current record, without "File Provider" or "Credentials", or with an empty "File Id", the command is skipped and the action continues.
  2. A value that is not a valid file ID deletes nothing; this is written to the log.
  3. The file is marked for deletion on the current record. It is deleted from the storage when the record is saved – at once with "Save" on, otherwise with the next save. If the save fails, the action ends with an error.
  4. Errors of the storage during the save are only written to the log.

The command deletes the file with the given ID regardless of its identifier or of the record it was added on. Make sure the ID comes from the right list.


4. Examples

Replace the contract document of a record.

  1. Get Files with the identifier contract- followed by the record ID writes the list into the variable ContractFiles.
  2. "Remove File" with "File Id" = a Modify Value expression on ContractFiles with the rules JArrayFirstElement and JObjectJsonPathValue (path Id), "Save" off.
  3. Add File with the new document and "Save" on – the deletion and the new file are stored with the same save.

To remove all files of a list, use Iterate JSON over the list and read the Id of each element.


5. Limitations

  • There is no undo.
  • The command does not check that the file belongs to the current record.