how to upload the document in sys_attachement table with Table name as a "sys_attachement"

Rameshnathan
Tera Expert

Hi Fiends

I have to upload the document in   sys_attachement table with Table name as a "sys_attachement", But whenever i uploading the document it is stored in the sys_attachment table but with different table name, but i want the Table Name should be the "sys_attachement" (so that only i am able to download using HTML link)

how to upload the document in sys_attachement table with Table name as a "sys_attachement"

find_real_file.png

Please help me to resolve this issue

Thanks

Ramesh

11 REPLIES 11

I just added this in a UI page and it works fine.



<a href="/sys_attachment.do?sys_id=0d3d6c31dbbbb200d8ccd421cf9619a1" target="_blank">Attachment</a>


Still i am facing the same problem,   is the table name is sys_attachment means it working fine other table means its not able to download.



can you please provide me the code which is you used..?


That is the single line of code that I added in a UI page and tested it.


aswinsiddaling2
Kilo Guru

As kalai has already mentioned, changing the table name would not be the appropriate way to handle this. If you do not want the end users to see that attachment but still it has to reside with ServiceNow



1. If it is an image, go to Live feed and upload the image. The thumbnail of the uploaded image will be saved with table name as sys_attachment by default


2. From ServiceNow's Email client, upload the attachment and send it to yourself and it gets saved in sys_attachment table with table name = sys_email



But these will hide the attachment from the end user in terms of UI but still they can download the attachment if they know the whole link


VaranAwesomenow
Mega Sage

Dear Ramesh,


I used the exact script that you have provided(by updating the sys_id of the attachment record) and it worked ok for me on my personal dev, the attachment got downloaded fine as well. I used below query to get the sys_id of the attachment record as that field is not available on the list view



var gr = new GlideRecord('sys_attachment');


gr.query();


if(gr.next()){


gs.print(gr.sys_id);


}


output is shown below, I used this sys_id in my UI page script


find_real_file.png


UI page



<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


<p>Please attach the documents of Configuration Item in the attachments field</p>


<p><strong><font color="blue">Please download Template Form for Provisioning, </font> <a href="/sys_attachment.do?sys_id=003a3ef24ff1120031577d2ca310c74b" target="_blank"><font color="green"><u>Click Here</u></font></a><font color="blue"> to download form</font> </strong></p>


</j:jelly>



find_real_file.png



attachment record



find_real_file.png



Please let me know if you have any queries.



Thanks
Anil