How to display a field of type Image on a widget?

Jordan Dehneh
Tera Expert

Hello,

I have a field of type 'Image' which can take an image. I want to display this image on a widget I have. I tried showing it on the widget but it gives me a sys_id instead. How can I show it ?

Thanks

1 ACCEPTED SOLUTION

Hello Anil,

 

No worries, I got it solved now. it should be

 

<img ng-src="{{::data.picture + '.iix'}}"/>

 

and in server script:

 

data.picture = grRec.getValue('u_image');

 

Thank you for the help Anil 🙂

View solution in original post

8 REPLIES 8

Anil Lande
Kilo Patron

Hi,

If you have a image field on record then follow below steps:

In server side script where you have written glideRecord to get image use below logic:

data.picture = grRec.u_image;

 

and to display image in use below login in Widget HTML script:

<img ng-src="{{::data.picture}}"/>

 

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Thank you Anil. I have implemented the same solution you suggested but it shows an empty braces brackets in the src field. If I also did data.picture = grRec.getValue(u_image); it will show a sys_id instead. What do you suggest?

Not sure if it is typo in community reply, but your need to correct below line 

data.picture = grRec.getValue(u_image);

it should be:

data.picture = grRec.getValue('u_image');

 

Thanks,

Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hello Anil,

 

No worries, I got it solved now. it should be

 

<img ng-src="{{::data.picture + '.iix'}}"/>

 

and in server script:

 

data.picture = grRec.getValue('u_image');

 

Thank you for the help Anil 🙂