How to add image from "db_image" table on service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2021 05:27 AM
Hello All,
We have a requirement to showing the image on service portal.
Instead of showing Image we are getting image sys_id.
We want to fetch the image from db_image table.
Any help on this would be appreciated.
Thanks,
Sayan
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2021 01:43 PM
Hi Sayan,
To show the image, you need the value from the "Name" field on the db_image record. We can grab that value by getting the GlideRecord of that db_image record using the Sys ID. Here's a function to do this. Just pass in the sys_id of the db_image record and it will output the URL path you will use in the src attribute in the img tag.
function getImageLink(imgSysId){
var img = new GlideRecord('db_image');
img.get(imgSysId);
return '/'+img.getValue('name');
}
If my answer was Helpful or solved your issue, please mark it as "Helpful" or "Correct"
Thanks!
Josh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2021 09:04 AM
Hey Sayan,
Was my answer able to resolve your question? What issues are you still having?
Thanks,
Josh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2021 09:18 AM
Hi Josh,
thanks for your suggestion.
i am using oob widget image carousel , which is fixed my issue.
Thanks,
sayan

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2021 02:11 PM
If you are using the "db_image" table, you can use this script. You can even add the image to the knowledge article and look at the source code and copy that code too.
<p><img style="align: baseline;" title="" src="<filename.file type>"***Change the name** alt="" width="315" height="160" align="baseline" border="" hspace="" vspace="" /></p>
<p><img style="align: baseline;" title="" src="images.jpegx" alt="" width="315" height="160" align="baseline" border="" hspace="" vspace="" /></p>