English
file_attachment
About 254 wordsLess than 1 minute
2025-09-22
Attachment fields are triggered in the field.edit.before stage, before adding or deleting files.
Parameters
| Parameter | Description | Type |
|---|---|---|
| fieldName | api_name of the field that triggered the event | String |
| objApiName | api_name of the object that triggered the event | String |
| dataIndex | dataIndex of the record that triggered the event, used for detail-object data | String |
| type | add, meaning the action is adding files | String |
| selectFileParams | Parameters that will be used to open the attachment picker control. These can be modified in the plugin | Object |
Delete:
| Parameter | Description | Type |
|---|---|---|
| type | del, meaning the action is deleting files | String |
| fileInfos | Attachments about to be deleted | Array |
Return Value
| Parameter | Description | Type |
|---|---|---|
| consumed | true means subsequent logic will not continue | Boolean |
| selectObjectParams | Parameters that will be used to open the object picker | Object |
| selectObject | Object-selection method (async). The plugin handles the selection logic and returns the selected data. Multi-select is supported | Function |
fileInfo properties
| Property | Description | Type |
|---|---|---|
| filename | File name | String |
| ext | File extension | Object |
| size | File size in bytes | Number |
| path | Uploaded images may have a path | String |
| fileId | Only available for cloud-disk files (not guaranteed) | String |
| filePath | Local file path (not guaranteed) | String |
Code Example
Implement the selection control in the plugin and replace the default picker:
{
event: "field.edit.before",
functional: function (pluginExecResult, options) {
let selectFile = async function(params){
let fileInfos=[]
return {fileInfos}
}
return {selectFile}
}
}Notes
- Calling
dataUpdaterto update data in this event is not suitable. - When editing existing data,
fileIdandfilePathmay not be available.
