
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2025 02:11 PM
Hello guys!
I am facing a issue regarding sending attachments from ServiceNow to the GLPI ITSM. Via POSTMAN it all works just fine, but when I've tried to do the same internally with ServiceNow, the file arrives in the other side, mas, in a corrupted manner or it just have the content 'Undefined' in it.
If someone could help me out it will be very nice! I put the script that I use in the SCRIPTS BACKGORUND bellow and the POSTMAN screenshots in attachment
{"id":11057,"message":"Item adicionado com sucesso: notepad.txt","upload_result":{"filename":[{"name":"681bb8f71971e2.23658968notepad.txt","size":0,"type":"","error":"O arquivo enviado foi parcialmente enviado","prefix":"681bb8f71971e2.23658968","display":"notepad.txt","filesize":"0 B","id":"docfilename1027737742"}]}}
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 11:14 AM
From what I remember, you can't set the bytes of the image directly into the form body using ServiceNow's API, instead, you can try using the method:
request.setRequestBodyFromAttachment('<attachment sys_id>');
RESTMessageV2 - setRequestBodyFromAttachment(String attachmentSysId)
This may simplify your code since you don't have to create the form yourself, but it also may limit the ability to customize the form to fit your endpoint.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2025 11:14 AM
From what I remember, you can't set the bytes of the image directly into the form body using ServiceNow's API, instead, you can try using the method:
request.setRequestBodyFromAttachment('<attachment sys_id>');
RESTMessageV2 - setRequestBodyFromAttachment(String attachmentSysId)
This may simplify your code since you don't have to create the form yourself, but it also may limit the ability to customize the form to fit your endpoint.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2025 04:54 AM
I could provide a solution making a mix of both techniques.
Thank you for your suport!