How to attach file from a local machine to a particular record.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2025 12:00 AM
My local machine folder(Documents) has a list of attachments with different types like PDF, JPG, etc.
The attachment file name starts with incidentNumber_fileName. For example: INC123456_users.pdf.
Requirement: I have to attach these attachments to their corresponding incident. How to do this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2025 12:48 AM
Hey @Vishal_Jaiswal ,
You can do it by data import. Refer to below post which explain it by step by step:
Create a new data source by navigating to System Import Sets > Data Sources and clicking on New. Fill in the necessary details such as Name, Table Name, and File Extension.
Bult Upload Attachment - Community ,
You can upload attachment using API methods as well via REST. It requires tool like powershell or windows batch scripting for more detailed explanation follow the below.
pathwayscg.com/loading-attachments-to-servicenow-from-a-local-machine-via-batch-scripting-in-windows/
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2025 12:50 AM
Hi @Vishal_Jaiswal
I don't think it's possible to pick a file directly from your local machine using a script. However, you could try storing the file in one of your organization's shared paths and then use your MID server to retrieve the file from that shared location into the instance.
I've tried this, but you can give a try and see how it goes..
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2025 12:57 AM
Hi @J Siva ,
Can you please share the steps with code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2025 01:03 AM
@Vishal_Jaiswal Check the below article to import files form Mid sevrer.
Automated Data Import - Using MID Server and PowerShell
Make sure that the file is stored in the Mid server host/shared path
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2025 01:54 AM - edited 08-24-2025 12:54 AM
If your attachments are named with the incident number at the start, you could write a script (like in Python) to scan your folder, parse the incident number from each file name, then upload or attach the file to the matching incident in your system via its API or interface. depends on what system you’re using for incidents though, what platform is it.
