Retrieve Image from db_image record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
Hi Everyone,
I have a use case to retrieve the Image content of db_image table record.
We usually have a image field in db_image record where our uploaded image is stored.
Using the below script I tried retrieving the same image but the response is empty:
Could someone please help me in getting the uploaded image? I have to add it to an outgoing email text as signature.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @HrithikN
There are 2 ways to do it
First way -
Open that particular image and you will see a html code with path that's available.
Follow below steps
Copy below highlighted part
In your notification, click on 'source code' icon and paste the content - The image will be attached.
Second Way :
Click on the Image icon in your notification and give the Name of the db_image record( see screenshot below)
Third Way :
If you want to achieve this with email script then use below logic
var grDbImage = new GlideRecord('db_image');
if (grDbImage.get('687fa131eb1301003eadeb29a206fe05')) {
// gs.info('image: ' + grDbImage.getValue('name'));
template.print('<img src="' + grDbImage.getValue('name') + '" width="300" height="450">');
}
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
are you using this in email script?
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