How to assign Image in db_Image table to an Image field type?

eduzol
Tera Contributor

Hi team,

I just imported images using a zip file attachment into db_image table.

We also have a Images table in our scoped application with an image field and some additional metadata.

Now that I imported the images, how can I assign an imported image to a Image field in my application?

I looked into the Image field documentation : Add an image field   , but found no instructions to do that.

Maybe I can use GlideRecord api?

Please help.

Kind regards.

-

Eduardo

1 ACCEPTED SOLUTION

eduzol
Tera Contributor

Hi Team,



After doing some additional research I found the solution which I will share for the benefit of the community:


How to Copy One image(Field 1) to another image(Field 2) both fields are of Image type



Basically we can use GlideSysAttachment to link an image imported in db_image table to an existing IMage field in any scoped application table.



var ga =   new GlideSysAttachment();


var attachments = ga.copy('db_image', yourImageAttachment.sys_id, 'ZZ_YYx_your_table',row.sys_id);



Thanks


View solution in original post

8 REPLIES 8

Hi Eduardo,



Kindly explain the significance as to why you want to go anti clockwise instead clockwise.


If you want some image to be link to your image field just make image field as reference field and it should reference to db_image table.



find_real_file.png


else directly upload the image on to image field as field type as image instead uploading it to db_image and then trying it to bring it on form.


find_real_file.png


eduzol
Tera Contributor

Hi Team,



After doing some additional research I found the solution which I will share for the benefit of the community:


How to Copy One image(Field 1) to another image(Field 2) both fields are of Image type



Basically we can use GlideSysAttachment to link an image imported in db_image table to an existing IMage field in any scoped application table.



var ga =   new GlideSysAttachment();


var attachments = ga.copy('db_image', yourImageAttachment.sys_id, 'ZZ_YYx_your_table',row.sys_id);



Thanks


I have tried this and could not get this to work. I don't see the images being attached to the image field. Any suggestions?

@samadam did you find any solution?