Attachment
- Last UpdatedJun 25, 2024
- 2 minute read
Use scripts to set and get values for the properties of the Attachment control.
Basic
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Name |
Yes Writable Readable |
To set the property control.findById("ID").tagName = "Value for Name"; To get the value of the property control.findById("ID").tagName; |
|
XML Node |
Yes Readable |
To get the value of the property control.findById("ID").xmlNodeBoundTo; |
|
Description |
Yes Writable Readable |
To set the property control.findById("ID").description = "Value for Description"; To get the value of the property control.findById("ID").description; |
|
Tooltip |
No |
Not Applicable |
Appearance
|
Property |
Scripting Supported |
Script |
|---|---|---|
|
Enable |
Yes Writable Readable |
To set the property control.findById("ID").enable = true; To get the value of the property control.findById("ID").enable; |
|
Visible |
Yes Writable Readable |
To set the property control.findById("ID").visible = true; To get the value of the property control.findById("ID").visible; |
|
Label Position |
No |
Not Applicable |
|
Label-Control Area |
No |
Not Applicable |
|
Retain Space |
No |
Not Applicable |
|
File Name Length |
No |
Not Applicable |
|
Custom Style Sheet Identifier |
No |
Not Applicable |
Validation
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Attachment Type |
No |
Not Applicable |
|
Custom Attachment Type |
No |
Not Applicable |
|
Show Delete Confirmation Message |
No |
Not Applicable |
|
Delete Confirmation Message |
No |
Not Applicable |
Advanced
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
On Data Change |
Yes |
For more information, see scripting guidelines for On Data Change property. |
|
ID |
No |
Not Applicable |
|
Storage Type |
No |
Not Applicable |
|
Persist File Name |
No |
Not Applicable |
|
Persist Custom File Name |
No |
Not Applicable |
|
File Path Template |
No |
Not Applicable |
|
Allow Multiple Attachments |
No |
Not Applicable |
|
Maximum Attachments |
No |
Not Applicable |
Scripts
|
Property |
Scripting Supported |
Example |
|---|---|---|
|
Name |
Yes |
return "Value for Name"; |
|
Description |
Yes |
return "Value for Description"; |
|
Enable |
Yes |
return true; For more information, see scripting guidelines for Enable property. |
|
Visible |
Yes |
return true; For more information, see scripting guidelines for Visible property. |
Note:
- We do not recommend editing values using APIs.
- You can retrieve the file name via script as follows:
var fileListArray = control.findById("ID").fileList;
if (fileListArray.length > 0)
{
return fileListArray[0].name(); // Gives the file name.
}
else
{
return “”;
}
- You can retrieve the file via script as follows:
var fileListArray = control.findById("ID").fileList;
if (fileListArray.length > 0)
{
return fileListArray[0].fileObject(); // Gives the file object.
}
else
{
return “”;
}
- The fileList represents an array of fileDetails. You can access each file’s details using the above syntax.
- The skFilePath property is not supported in the Script Editor's intelligent code completion.
- You can empty the attachment control value via script as follows:
control.findById("ID").skFilePath = “”;
control.findById("ID").value = “”;