SimpleOne supports attaching files to records. See the Attachments article to learn how to upload, download and delete files attached to a record using the portal or agent interfaces. This article provides information on how to configure various aspects of the system related to attachments:

Attachment in interface

Action and Image field


You can attach files to a field of Image type and a record with the attachment action. The action is displayed on forms as the paper clip icon .

The screenshot below illustrates two attachment actions on the record form:

Attachment widget


Attachments can be added via an attachment widget in the agent interface. For this, you need to use the <attachment> SimpleTag within a certain widget instance. It is unnecessary to specify the recordId, tableName attributes for the <attachment> tag located on the page with the form. Therefore, a widget template with an attachment tag will look like this:

<attachment> </attachment> 

After adding a widget instance to a form of the agent interface, the standard action in the top right corner of the form will be removed:

You can add files from the clipboard to the widget directly on the form by using Ctrl+V shortcut while hovering over Drag & drop area.

Attachment record 


When you upload a file, a record is created in the Attachment (sys_attachment) table. To reach these records, navigate to Attachments → All Attachments.

Attachment record form fields

Field

Mandatory

Description

Document record

N

Displays the name of the record to which the file is attached. Field type: Document ID.

File name

Y

Specifies the file name.

File path

N

Specifies the absolute file path on the server.

Size bytes

N

Defines the file size in bytes.

MIME content type

Y

Specifies the file content type described in the MIME standard.

Public

N

This attribute displays that this attachment has a permanent link and is available for public access.

Parsing


Parsing attachment content is possible only if the attachment file size does not exceed 30 MB. The limit is fixed and cannot be modified. If the file is bigger than 30 MB, it will not be indexed.

The attachment parsing process is asynchronous. Within this process, the following event is implemented:

  1. In the Attachments (sys_attachment) table record, the attachment content parsed from the provided file is placed. The attachment content is populated in the Content field, and the content encoding – in the Encoding field. The content encoding is automatically detected.

Attachment logging 


The system logs all operations (except for reading) in the Main Log (sys_log) table. Operations related to attachments have the Source field value equal to Attachment. Navigate to System Logs → Main Log.

If any errors or exceptions were thrown during the attaching process, they can be found in the Exception Log (sys_log_exception) list. Navigate to System Logs → Exception Log.

Refer to the System Audit article to learn more.


Configure attachment properties 


To set up attachment properties, complete the following steps:

  1. Navigate to System Properties → All Properties.
  2. Find the property record you need, using the list search boxes or the condition builder, and open it.
  3. Edit the Value field.

  4. Click Save or Save and exit to apply the changes.

Property

Description

max_files_upload_count

Maximum number of files that can be uploaded.

max_file_size_upload

Maximum file size (in bytes) that can be uploaded.

allowed_upload_file_extension

File types that are allowed for uploading. List the extensions separated by commas without spaces, for example, jpeg,png,pdf. Files of other types will be ignored. To allow all types of files, type [].


Access to attachments 


Using the Access Control List (ACL), you can restrict operations on Image columns for users with specific roles. 

Role required: security_admin.

Restrict access to fields of Image type


To restrict access, perform the following steps:

  1. Navigate to System Security → Access Control (ACL).

  2. Click New and fill in the fields.

  3. In the Column field, select the image column you need to secure.

  4. Click Save or Save and exit to apply the changes.

As a result:

  • There will be restrictions on creating, editing, and/or reading columns in a specific table. 
  • The specified rules will be applied to the portal forms as well.

The table below describes the effect of the operation restrictions on an image field:

Operation

Description

create

The field is not displayed on a new record form and appears after saving the record.

read

The field and its contents (attached files) are hidden.

write

The field is read-only.

Restrict access to attachments


  • Attachments can only be uploaded by a user with rights to create records in the Attachments (sys_attachment) table, and with rights to edit records to which they are trying to upload an attachment. To prevent a user from uploading an attachment, set up access control to one of these operations.
  • Attachments can be deleted by a user with rights to delete records from the Attachments (sys_attachment) table, and with rights to edit or delete the record from which they are trying to delete an attachment.
  • Attachments can be downloaded by a user with rights to read the Attachments (sys_attachment) table and the record to which the attachment is attached.
  • Copying can be done by a user with read access to the table of the record to which the original attachment is attached, and with edit access to the table in which the copy is being made.

You can supplement the existing access control rules for the Attachments (sys_attachment) table with new rules containing other conditions. New rules should not contradict the existing ones. To do this, complete the steps below:

  1. Navigate to System Security → Access Control (ACL).

  2. Click New and fill in the fields.

  3. In the Table field, select the Attachment table.

  4. Click Save or Save and exit to apply the changes.

See the Access Control articles to learn more about access limitations.

  • No labels