How can I download a file from an URL and attach it to serivcenow
This content was last updated in 2023. It may still be useful, but could contain outdated information. Please confirm its accuracy before relying on it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 04:18 AM
Hi,
I have a requirement that a user will enter a URL which is a link to a file from the web.
Then service now will download it and attach it to the record (without using a mid server).
I can do a rest call to the URL but if it's a big file 10mb I cannot convert it to an attachment.
Any ideas?
Thanks,
Lior Grinberg
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 04:38 AM
Hi,
without using mid server I doubt it can be achievable if it is to get the file/data from external system
Regards
Ankur
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 07:25 AM
Hi Lior,
You have a couple of options - neither of these require a MID server as long as the location is reachable from your ServiceNow instance directly.
1. RESTMessageV2 has a saveResponseBodyAsAttachment() method. You must provide a reference to the record you want to attach the saved file to.
2. The REST step in IntegrationHub has an option to save a response as an attachment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2023 06:07 AM
Do you have options as well for downloading directly the file without extension from the URL this for example - https://.service-now.com/sys_atf_test_result_step.do?CSV I have added the basic authentication (setBasicAuth('xxxx', 'xxxx');) but it only downloads when there is a file extension in the URL