Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Auto-attaching attachment to a record

lightblu
Mega Expert

Hi,

I would like an attachment (word document) to be attached to each new record (in my request table) by default, as soon as the record gets created. How would I do this?

Right now I have to drag-and-drop the attachment onto each record.

Thanks!

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee

Hi,



You can upload attachment in sys_attachment table and then create a before business rule on incident table to copy attachment from sys_attachment table to incident table with the help of GlideSysAttachment.copy


More info here Copy Attachments from Record to Record - ServiceNow Wiki


View solution in original post

13 REPLIES 13

Hi Ahbinay,



I ran your script, but there seems to be a scoping issue (I'm using Geneva):



Create operation against 'sys_attachment' from scope 'x_prgm_red_team_te' has been refused due to the table's cross-scope access policy



What are my options for fixing this? It seems like all attachments in sys_attachment have global scope.


You will have to change Application access controls for the table. Go to sys_attachment table and right click on the list go to configure -> Table. In the application access check box the create and make sure it is accessible form all applications as shown in the below screenshot


conf1.PNG


find_real_file.png


Hi Abhinay, I just found out that this attaches an empty Word document to the record when it is inserted. I'm not sure why it's empty because the original document in the sys_attachments table is not. Thanks for the help.


Looks like you may also need to insert a record into the Attachment Documents table (sys_attachment_doc).   I tried the above script and also got an empty word document.   I just started working on this so I'll report back once I get it working.  


Hi Cameron,



Were you able to get the attachment to populate with data?



Regards,



RV.