How to delete or clear the values of a document’s fields with an operation or automation

Tabla de contenidos

The "Clean metadata" automation is an operation or automation in Athento designed to clear (empty) the values of one or more metadata fields of a document, in a simple way and configurable from the user interface.

What is this automation used for?

This operation is especially useful in scenarios where it is necessary to remove sensitive information, reset fields for a new processing cycle, or simply clear metadata values that are no longer relevant in the document. For example:

  • Delete personal data before archiving a document.
  • Clear control fields after a review process.
  • Prepare documents to be reused in another workflow.

How does it work?

The automation allows selecting, from the operation’s configuration, the metadata fields that you want to clear. Once the operation is executed on a document, the values of the selected metadata fields are removed (left empty).

Configuration parameters

  • Metadata to clean: Allows selecting one or more metadata fields from the form. It is a multiple "choice" type field, which makes it easier to select several fields at once from the operation configuration interface.

Internal logic

  1. Retrieving the document: The operation receives the UUID of the document on which it is executed.
  2. Metadata selection: It retrieves the metadata fields selected in the configuration.
  3. Clearing values: For each selected metadata field:
    • If the metadata field has a value, it leaves it empty ('').
    • If the metadata field has an associated file value (file_value), it removes it (None).
    • It saves the changes to the metadata field.
  4. Result: Returns a success message indicating that the operation executed correctly.

Example of use

Suppose you have a form with the fields "DNI", "Phone" and "Notes". You can configure the operation to clear only "DNI" and "Phone" after completing a process, leaving the rest of the information intact.

Configuration from the interface

Thanks to the definition of type and subtype parameters, the operation can be easily configured from the Athento interface, selecting the fields to be cleared without having to modify the code.