Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
SimpleOne supports attaching attaching files to existing or newly created records such as incidents, change requests, and some others.
The files can be attached in two ways:
- via the attachment action
- via the attachment widget.
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:
- configure attachment actions in the interface.
- manage attachment records.
- parsing.
- monitor the system logs.
- set the system properties.
- configure access to attachments.
Attachment in interface
Anchor action action
action | |
action |
Action and Image field
You can attach files to a field ofimage Image type and a record with the attachment action. It The action is displayed on forms as the paper clip icon Image Removed
Image Added.
The picture screenshot below illustrates two attachment actions on the record form:
Operate the attachments using the SimpleAttachment API methods.
Attachment widget
Anchor widget widget
widget | |
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:
Code Block |
---|
<attachment> </attachment> |
Info |
---|
After adding a widget instance on to a form of the agent interface, the standard action
|
Add and manage attachments
You can |
add files |
by clicking Select files and adding them via the file manager
by dragging and dropping files in the window
by pressing Ctrl(Cmd) and V keys on your keyboard to paste an image from the clipboard
by clicking Add files and selecting them via the file manager if files have been uploaded before.
Image Removed
File uploading
To attach a file to some record, complete the steps below:
Navigate to a record you need to work on.
Open the Attachments window:
Click the attachments icon
Image Removed at the top right corner.
Click the attachments icon
Image Removed by the field name.
Attach the file you need. Attached files appear at the top of the form or by the field name.
Close the Attachments window to return to the record.
Click Save or Save and Exit.
Info |
---|
When uploading a file via the attachments icon at the top right corner, you do not need to save the record. Attached files are saved on the server automatically. |
The picture below illustrates the attachment window:
Image Removed
File deleting
To delete a file uploaded earlier, complete the steps below:
Navigate to a record you need to work on.
Open the Attachments window:
Click the attachments icon
Image Removed at the top right corner.
Click the attachments icon
Image Removed by the field name.
Delete a file or files in following ways:
If there is one file, click Delete.
If there are several files, hover the cursor over a file you want to delete, click the three-dots icon
Image Removedand select Choose. Repeat for other files you want to delete. Click Delete.
Image Removed
Click Select all and Delete to remove all uploaded files.
Close the Attachments window to return to the record.
Click Save or Save and Exit.
Info |
---|
When deleting a file via the attachments icon at the top right corner, you do not need to save the record. Attached files are saved on the server automatically. |
Parsing and indexing
from the clipboard to the widget directly on the form by using Ctrl+V shortcut while hovering over Drag & drop area. |
Attachment record Anchor record record
record | |
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 Anchor parsing parsing
parsing | |
parsing |
Parsing attachment content is possible only if the attachment file size does not exceed 30 MBAttachment content parsing and indexing are possible only if the attachment file size is under 30 Mb. The limit is fixed and cannot be modified. If the file is bigger than 30 MbMB, it will not be indexed. The warning message related to the indexation will be written to logs. You will be able to find more information later in the Main Log (sys_log) table using the criteria below for the filter:
Level IS Warning
Message Contains { Attachment ID }
Indexing is performed only for specific file formats. The Content field will be automatically filled with the text content of the attached file if the file extension is included in the list: 'txt', 'ini', 'reg', 'csv', 'json', 'htm', 'html', 'doc' , 'docx', 'xls', 'xlsx'. Full Text Search is enabled within the Content field. It allows you to search globally for its content.
Note | ||
---|---|---|
The attachment parsing and indexing process is asynchronous. Within this process, the events below are implemented: Some file is attached to a record to any table (for example, to a record 164313550512027919 in the Task table). After that, a search index for this attachment is created. Technically, it is a record in the Search Indices (sys_search_index) with the fields populated like shown below: | ||
Field | Type | Value |
Record | Big Integer | 164313646211541086 |
Table | Reference | Attachment |
Column | Reference | Content | Text | Text | In this field, the attachment content appears.
Attachment
Download URLAttachment records can be public or non-public. The publicity of attachments affects whether an attachment link will have an expiration date.
- Links to public attachments do not expire.
- Non-public attachments have a lifetime of 1 hour by default from the moment they are generated. The lifetime of a link is determined through the system property s3.presigned.link.lifetime.
The Is Public attribute on the Attachment form defines the publicity of attachments.
There are two ways of generating attachment links:
- your-instance-url – the address of the instance where the attachment resides. If the attachment in on the same instance that the script is running on, use a relative link `/v1/attachments/download/${sys_attachment.sys_id}?access-token=${s_user.accessToken}`.
- sys_attachment.sys_id – Attachment ID.
- user_token – user token. To get the current user's token in the client script, use the s_user.accessToken property. To get the current user token in the server script, use the getAccessToken() method of the SimpleUser() class.
Use the getAttachmentUrlById() Server API method to get the link.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
const current = new SimpleRecord('sys_attachment');
current.get('164313646211541086');
const ATTACH_ID = current.sys_id;
const simpleAttach = new SimpleAttachment();
const attachUrl = simpleAttach.getAttachmentUrlById(ATTACH_ID); |
Depending on the publicity of an attachment, two links will be generated. For example:
logging Anchor log log
log | |
log |
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.
Image Added
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 Anchor property property
property | |
property |
To set up attachment properties, complete the following steps:
- Navigate to System Properties → All Properties.
- Find the property record you need, using the list search boxes or the condition builder, and open it.
Edit the Value field.
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 Anchor access access
access | |
access |
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:
Navigate to System Security → Access Control (ACL).
Click New and fill in the fields.
In the Column field, select the image column you need to secure.
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:
Navigate to System Security → Access Control (ACL).
Click New and fill in the fields.
In the Table field, select the Attachment table.
Click Save or Save and exit to apply the changes.
See the Access Control articles to learn more about access limitations.
for public attachments: https://s3-{your-instance-url}/public-attachment/9/b7/prp5bikeyg70mpn7mhfszi4amgzleo?response-content-disposition=inline%3B%20filename%3D%22image.png%22&response-content-type=image%2Fpng%3BTable of Contents | ||||||
---|---|---|---|---|---|---|
|