Part of the Tips 'N Tricks" series.
In a related article, TNT: "Related Attachments" Related List, I talk about creating a Defined Related List to pull together attachments from related records so they can show up on the form view of all those records (e.g. Service Desk Calls and Incidents):
It's nice to have them all in one place, but the "Table name" and "Table sys ID" fields are not very useful. Luckily we can improve on that.
We simply need to create a new calculated field called "Record" of type "Document ID" on the Attachment table. To do this, enter "sys_attachment.list" in the Navigator filter - this will display a list of attachment records. Then right-click on the list header and select Configure \ Dictionary. Create a new record with the following settings (you may have to click on the Advanced View Related Link to show some of these fields):
Table: Attachment [sys_attachment]
Type: Document ID
Column label: Record (or whatever else you prefer)
Use dependent field: checked
Dependent on field: Table name
Calculated: checked
Calculation:
(function calculatedFieldValue(current) {
return current.getValue("table_sys_id");
})(current);
I normally steer everyone away from Calculated fields because they can be expensive in terms of database cycles, however, I am told that creating a calculated field from values that are available on the same record is indeed safe.
Now we can have a useful Related List on the appropriate forms by replacing the fields that are displayed (right-click Configure \ List Layout) by removing the "Table name" and "Table sys ID" fields and adding the new "Record" field:
Now you can see the record the attachment is actually on, and even click on the link to go to that particular record.
NOTE: My earlier blog post, A Better Requested Item Attachments Related List, got a little messy so I split it into 2 different posts so it would be easier to read and update. This post is the second of those 2 new posts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.