Scripted Rest API call sending Attachment along with creation of incident data is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 10:06 AM
Team,
I wrote a scripted API and trying to post the data from rest API explored, but i dont see provision to add attachement data from explorer to test the case.
May i know how to achive this?
{
"short_description": "Issue with mobile device",
"caller_id": "73A",
"attachments": [
{
"file_name": "example.txt",
"content_type": "text/plain",
"file_content": "VGhpcyBpcyBhIHNhbXBsZSBmaWxlIGNvbnRlbnQu"
}
]
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-09-2024 11:23 AM
Duplicate post, please don't spam the forums: https://www.servicenow.com/community/developer-forum/how-to-create-an-incident-along-with-adding-an-...
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2024 06:28 PM
Thank you Allen, Tried to find related post from your blog , but dont find it.
Using below script for attachements creation along with creation of incident , i have written the below code. But I am getting 500 internal error. with the below error message.
{
"error": {
"message": "Script Evaluation Exception",
"detail": "Can't find method com.glide.ui.SysAttachment.write(string,undefined,undefined,undefined). (sys_ws_operation.f5d38f17ffbfc210b9bff9337c4fd93d.operation_script; line 37)"
},
"status": "failure"
}
Can you help me sorting this issue:
"short_description": "Issue with mobile device",
"description": "Issue with mobile device",
"level1": "iphone",
"level2": "Charging",
"attachments": [
{
"fileName": "example.txt",
"contentType": "text/plain",
"content": "VGhpcyBpcyBhIHNhbXBsZSBmaWxlIGNvbnRlbnQu"
}
]
}