saveAttachment()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 04:36 AM
Hi everyone,
The saveAttchment ('table_name','sys_id of record') function will allow us to attach a document to a record.
Can anyone tell me where to locate this function and how it works??
Regards,
Arnab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-02-2017 04:39 AM
Hi Arnab,
It's built in to one of the client script libraries that gets sent to the the browser when your page is loaded. I see it mentioned only in two places in the system.
- A UI action called New
- A UI page called assessment_take2
It is not documented in the API info on the developer site nor does it appear to be editable/viewable by admins.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2017 06:01 AM
Thanks Chuck,
Is there a way to call this function server side?
Regards,
Arnab

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-07-2020 06:37 AM
I believe it is possible to find the attachment record you create with this function by querying sys_attachment GR limited to table_name and table_sys_id entered as params while calling saveAttachment()
It works even for the table_sys_id which does not exists, I am going to (ab)use it in my UI action available in the list allowing users to add attachment to selected records
- for each such request I will create new fake_table_sys_id and let SN save attachment for it
- then I will send the fake_table_sys_id via GlideAjax to the server together with list of sys_ids of selected records
- there I will iterate over the selected sys_ids and copy attachment identified by its fake_table_sys_id to all of them using GlideSysAttachment.copy(table_name, fake_table_sys_id, target_table_name, sys_id_from_selected)