Relabel Attachment Links
How to shorten attachment links to something more readable

Without this code, when attachment file names display in tables they can be super long and distort the readability of the field and the table as a whole. Relabeling gives the column a consistent width. This code could be further updated to specify a certain view for your specific use case.
There are two ways to label attachment files:
Option A : Default Name
Option B: Field File Name (Table views only)
Option A: Default Name
Modifies all attachments that are a File field asset with a default attachment name using HTML
The JS
We create a handler that renders on any application view and sets the attachment link text.
The CSS
None needed 😎
How to Implement
Adjust text to the preferred nomenclature if other than Attachment (i.e. "File")
You may use:
Attachment
View
File
Option B: Field File Name (Table views only)
Modifies one of the attachment field File types HTML to another field instead. This will only work for connected file fields connected to a parent table view.
Examples:
Work Orders table view connected to multiple attachments
The JS
We create a function that renders on any application view and sets the attachment link text in the table view using HTML. We add also add the field to the table as well to leverage the text used in that same table and use the span id attribute to tie it to the file field.
The CSS
None needed 😎
How to Implement
Copy JS above and modify line 37.
field_XXXis the File type field IDfield_YYYis the text(may use any type) field ID
Last updated
Was this helpful?