- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-03-2016 02:21 PM
I want to upload a PDF somehow to my instance and then call that PDF as a link to be viewed and/or downloaded. I have a UI page setup, but can't figure out how to upload a PDF and then call that PDF in my code. HELP!!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 06:38 AM
Charlie, so I did some looking online and it looks from these strings that truly public kb isn't possible:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 06:48 AM
Keep an eye on the "making a knowledgebase public" or my thread, Im hoping that within a couple of weeks have something there for everyone to use or at least as a ground to stand on.
Or at my blog of course. that's where I'll post the whole solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2016 07:20 AM
Hi Charlie,
Recently, I have done little work on attachments. Sharing it here in case it may be helpful.
1) Created a Public processor with the below code and path as "attachment"
var grattachment = new GlideRecord("sys_attachment");
grattachment.addQuery('sys_id','615ea769c0a80166001cf5f2367302f5'); // I have hardcoded Sys_id here as an example. Replace it with any attachment sysid
grattachment.query();
if (grattachment.next()) {
var fileName = grattachment.file_name.toString();
var contentType = grattachment.content_type.toString();
g_response.setHeader('Pragma', 'public');
g_response.setContentType(contentType);
g_response.setHeader('Content-Disposition','attachment;filename='+fileName);
var glideSysAttachmentInputStream=new GlideSysAttachmentInputStream('615ea769c0a80166001cf5f2367302f5');
glideSysAttachmentInputStream.writeTo(g_response.getOutputStream());
}
Thats it, Now the document is publicly downloadable !!. You can make this processor as parametrized (accepting sys_id of the attachment) and expose any number of attachments.
Hope this helps
Srini
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2016 11:57 AM
Srini, where would you put this script in order to make a document available to someone who is not logged in to the instance? Would you then be able to put a link referencing the download location in an email notification?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2024 11:45 AM
Any attachments seen on a form made for a record of a table are stored in the sys_attachment table of SN. To download a file from the sys_attachment table, you must log in or pass credentials using something similar to PostMan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-02-2017 10:07 PM
Hi Srinivas,
My requirement is to convert any doc file into pdf and then download it, How it is possible.
Otherwise I have written one code to copy the content of text file but the problem is in the case of doc file it is not able to get the exact content it is giving some kind of encoded character in case of text file it is copying the content to pdf but for Doc file its not working.
TIA,
Jeet.