
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2015 07:19 AM
I have a UI page where a user can upload an image to the sys_attachment table. The "table_sys_id" I'm giving this uploaded attachment is the sys_id of a certain record on an entirely different table, which all-in-all, corresponds to the form they are using. This feature is working great.
Well, now the user is needing to upload a second image, same UI page but with it's own "upload image dialog". Fine, no problem... however, because I later reference these uploaded images by the "table_sys_id" field on the sys_attachment table, I have no way to differentiate the two images to load in their respective locations on the UI page.
So, I was thinking about referencing by file name instead of table_sys_id.
Something like "7259ea8d6f330a040fd9122cbb3ee4a8_A" for the first filename, and "7259ea8d6f330a040fd9122cbb3ee4a8_B" for the second. I can do all the parsing on the UI page on load to make sure each image is displayed in the appropriate place.
I use this code to display the image on the UI page:
<img src="https://mydomain.service-now.com/ess/sys_attachment.do?view=true&sys_id=${jvar_this_record_sysID}" />
I guess I have a few questions.
- Is this the correct way to handle this?
- If yes, what <img> src link would I use to pull by "name" instead of "sys_id"?
- I seem to be brain-farting on where to change the file name to my specified value. I will paste the attachment code if needed.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2015 07:58 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2015 07:40 AM
So, as I'm sitting here thinking about it, I can query the sys_attachment table by the table_sys_id, then perform a while() loop and parse the file name that way. That eliminates the need to query based on file name.
Only stumbling block I'm at now is saving that unique file name instead of the actual file name.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2015 07:58 AM
Nevermind... I figured out a work-around to achieve what I need.