Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

sgrison
Tera Guru

 

If your fulfillment team works primarily from Catalog Tasks (sc_task), forcing them to open the parent RITM (sc_req_item) just to find attachments slows everything down and increases the chance that key files get missed. A cleaner approach is to expose RITM attachments directly on the catalog task by creating a Relationship to sys_attachment and adding it as a Related List on the task form.

 

Why This Works

ServiceNow attachments are stored in sys_attachment and are tied to a specific record via:

  • table_name (which table the attachment belongs to)
  • table_sys_id (the sys_id of the record on that table)

RITM attachments therefore have:

  • table_name = sc_req_item
  • table_sys_id = <RITM sys_id>

Catalog tasks don’t share the same table, so they don’t automatically display those attachments—unless you intentionally relate them.

 

The Relationship Script (refineQuery)

Use sys_attachment as the related list table and filter it using this refineQuery script:

 

(function refineQuery(current, parent) {

(function refineQuery(current, parent) {
                current.addQuery('table_name', 'sc_req_item');
        current.addQuery('table_sys_id', parent.request_item);
    })(current, parent);

})(current, parent);

 

What This Script Is Doing

  • current represents the query being built against sys_attachment (the related list table).
  • parent is the record you’re viewing the related list from—in this case, the Catalog Task (sc_task).

Line-by-line:

  • current.addQuery('table_name', 'sc_req_item');
    Limits results to attachments that belong to the RITM table.
  • current.addQuery('table_sys_id', parent.request_item);
    Filters those attachments to only the ones whose parent record matches the task’s request_item reference (the RITM sys_id).

Net result: the related list shows “attachments where the attachment belongs to the RITM that this task is for.”

 

How to Configure It in the Platform

  1. System Definition → Relationships
  2. Create a new relationship:
    • Applies to table: sc_task
    • Related list table: sys_attachment
    • Type: Refine query
  3. Paste the script above into the Refine query script field.
  4. Go to the Catalog Task form layout and add the new related list.

 

Notes and Common Gotchas

  • This approach does not copy attachments—so no duplication or storage overhead.
  • Attachment access still respects ACLs. If users can’t see attachments, validate permissions on:
    • sys_attachment
    • the parent RITM record (since you’re effectively surfacing its attachments)
  • If your tasks are sometimes created without request_item populated (custom flows), this related list will be empty by design.

 

This pattern is usually the most user-friendly and maintainable way to make RITM attachments visible where the work happens: on the catalog task.