saveResponseBodyAsAttachment without table name/sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2022 08:18 AM
Hi, I would like to retrieve Excel file from external source, save it as attachment in sys_attachment table, process and delete it finally.
Or just retrieve it, save in memory, and process. Closest guidelines I found - here
A challenge - saving an attachment requires adding target table (like incident) and sys_id (like its incident record):
request.saveResponseBodyAsAttachment(tablename, recordSysId, filename);
However my application does not interact with any table in SN, hence the method above does not work to me. Attaching to the script itself does not look to be a nice solution either. Any workaround?
Thank you in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2022 08:25 AM
Are you trying to avoid touching a table? If not, you could create a record in the Import Sets table (sys_import_set) and attach it there. The record will be automatically cleaned up after some time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 01:15 AM
Hi, thanks. Idea is to retrieve the file, extract one row from it, put it to remote table. I clearly do not need any usage of DB table in between unless it is absolutely required (if there are no any other ways to accomplish an objective).
Hope it helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2022 08:29 AM
Since your Excel file doesn't need to be associated with a record or table, it sounds like you should use data sources and transform maps instead. The data will be stored in an import set temporarily and deleted automatically later.
Create a data source using a static version of the Excel file so that you can create the transform map and process the fields in the spreadsheet. Then depending on how you get the Excel file, use the File Path and Connection URL fields in your sys_data_source record to determine how to retrieve it. If either of those fields changes, use a scheduled job to change the record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2022 01:06 AM
Hi. Retrieving Excel file in Data Source will still require to use an import set table (staging), I am just looking for a way how to load/process the data "on the fly" without storing them neither in temporary nor production tables. Apparently it is not supported OOB, thanks anyway.