How to get image url while querying the GlideRecord?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 04:33 AM
Hi All,
iam working on sc_category table. if i query the table getting all fields but images fileds like icon getting empy values.
this is my query,
var gr = new GlideRecord('sc_category');
gr.query();
while(gr.next()){
gs.print("icon value "+gr.icon);
}
-- getting result as empty.
How do fix that. can any one help please.
Thanks,
Rajendra Prasad Darshanam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 05:18 AM
It is quite interesting..Can we do this?
Actually all service now images will stores in images. under system UI -> images
apart that, image_picker.do in application navigator.
we can see the list of images and paths

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 05:31 AM
thanks ,
but i am working through rest api explorer for table, while sending GET request it's sending empty field to icon and other image fields.
thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2016 06:30 AM
Hello,
ServiceNow does not store any path values or so on the record itself. Any field of type "image" on a record is stored in the table "sys_attachment" where the field "table_sys_id" is the sys_id of your record and the field "table_name" is the name of the records table plus the prefix "ZZ_YY"; so in your case it would be "ZZ_YYsc_category".
So if you open a record that has a field of type "image", the system checks if there is any record in the table "sys_attachment" that fits the above explanation.
Unfortunately ServiceNow doesn't even store the sys_id of the sys_attachment into a field of type "image".
It might also be that, even though admin, while exploring the table "sys_attachment", you will not be able to see records where the field "table_name" is prefixed with "ZZ_YY". You need to add an ACL... at least that's what I was required to do.
Kind regards,
Michel Conter