This server class provides methods that allow operating with attachments.
copy(sourceTable. sourceID, targetTable. targetID)
This method copies attachments from the source record to the target record.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
sourceTable | String | Y | N |
sourceID | String | Y | N |
targetTable | String | Y | N |
targetID | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
copy
let attach = new SimpleAttachment(); attach.copy('user', '155964310500000059', 'sys_script', '155964310500000051');
deleteAttachment(attachmentID)
This method deletes the specified attachment.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
attachmentID | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
deleteAttachment
let attach = new SimpleAttachment(); attach.deleteAttachment('157052637119478714');
getContent(sysAttachment)
This method gets attachment content as a string.
Name | Type | Mandatory | Default Value |
---|---|---|---|
sysAttachment | SimpleRecord | Y | N |
Return:
Type | Description |
---|---|
String | The attachment content as a string. |
rename(attachmentId, fileName)
This method renames the specified attachment.
Parameter(s):
Name | Type | Mandatory | Default Value |
---|---|---|---|
attachmentId | String | Y | N |
fileName | String | Y | N |
Return:
Type | Description |
---|---|
Void | This method does not return a value. |
Example:
rename
let attach = new SimpleAttachment(); attach.rename('157052637119478714', 'new_name_1.png');
write(record, fileName, contentType, content)
This method inserts the attachment to the record specified.
Name | Type | Mandatory | Default Value |
---|---|---|---|
record | SimpleRecord | Y | N |
filename | String | Y | N |
contentType | String | Y | N |
content | String | Y | N |