Get picture from picture field on a form though a script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-13-2017 07:07 AM
Hello,
I added a field type : image
like this :
It's available on some other part of service now, like to upload the logo.
I would like to get this value.
My need:
I built a widget show some data, and I want to retrieve the picture attached to the record to show it on service portal
Anyone i've done this before ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2018 02:30 PM
Hi xif,
I had the same question and just found out the solution. In your widget's server-side script you need to grab the image name by using getDisplayValue. Here's an example:
var gr = new GlideRecord('sc_cat_item');
if (gr.get('04b7e94b4f7b4200086eeed18110c7fd')) {
data.name = gr.getValue('name');
data.picture = gr.getDisplayValue('picture');
}
Then in your widget's HTML:
<img class="img-responsive catalog-item-image" alt="{{::data.name}}" style="display: inline" ng-src="{{::data.picture}}" />
Calling getValue returns nothing, getDisplayValue returns the image file name (e.g. b28db9444f889200086eeed18110c724.iix )
Regards,
Amado
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-30-2018 11:31 AM
Thanks for posting this. Saved me a lot of time!
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2020 11:57 AM
That should be marked as the correct answer. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-27-2020 10:53 PM
Hello Amado,
How can I fetch the image from custom table to Multi row variable set(MRVS) form?
Let me explain the scenario. I have created custom table which stores Stationery items with images.
And have created MRVS which fetch data from custom table here I want to show respective Image when we select stationery item.
Can you please help?
Thanks in Advance
Monika