Extracting data from attachments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi All,
There is use case where user will attach an attachment that may be doc or pdf or png or excel or csv etc. Attachment will be on the incident form, Now we have to extract all the data which is in that attachments, How do we extract data in the attachment?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Akash_16
Make use of below REST message body and retry :
{
"contents": [
{
"parts": [
{
"text": "You are a very professional document summarization specialist.
Please summarize the given document."
},
{
"inline_data": {
"mime_type": "image/jpeg", // Change it based on image type
"data": "${imageBase64}" // Pass Base64 string of the image here
}
}
]
}
]
}
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Akash_16
If I understood your requirement clearly, you want to read the content of the attachments on an incident record. If yes, please note that not all the attachment types could be parsed within ServiceNow directly, for example, you can't get the .png file content until you make use of external LLMs like Gemini. If you wish to make use of external LLM, the approach would be to first convert the attachment into Base64 string and send it to the model for analysis.
If you just want to parse CSV files, please refer https://www.servicenow.com/docs/bundle/zurich-api-reference/page/app-store/dev_portal/API_reference/...
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
what you want to do after getting the content? you want to send to some 3rd party API?
What's your exact business requirement?
You can get base64Encoded data of the file but not direct content
within ServiceNow you can only read plain attachments such as (txt, csv, excel) etc.
You cannot read data from DOC, PDF, DOCX, PPT, PNG etc as they are complex file type.
For others you can use CSVParser or GlideExcelParser
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar ,
We need to send the content which is in the attachment to the AZURE AI, We are trying to send the attachment directly to the AZURE AI to get the summary of the attachment.