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

alekhyanagabhyr
Kilo Contributor

HI Everyone,

I have a requirement where I have to copy one image field value to another field as follows:

-- I have inserted image in "db_image" table this image stored in image field(FIELD 1) in that record.

-- I have another image type field FIELD2 in catalog task table

So I want to display image of FIELD1 to FIELD2.

Thanks,

Alekhya N

9 REPLIES 9

Hi Chuck.

 

One question. What would be the criteria to trigger a BR when a picture field changes on a given table since what is actually happening is a that a record gets created in the sys_attachment table?

 

I tried using the condition builder and adding a "When Picture Changes" filter but did not seem to do the trick.

 

Thanks

Miguel 

Rahul Jain11
Kilo Guru

H,

 

As Chuck explained, Image fields store their content as attachments. You'll need to use the standard attachment copy method to attach it to the right record and field.

When you upload an image to a field 1 then it stores in the sys_attachment table where file name would be the database column name of the field 1.

You can simply use the copy attachment functionality and then update the file name with the field 2 on the copied record.

 

Thanks

Thanks for the quick reply Rahu. I am afraid that really does not answer my question.

 

I understand that in order to copy an image from one field to another table field, you will use the GlideSysAttachment.copy() method and that creates the new record in attachments table. Meaning my image gets copied from the source table field to the  target table field.

 

What I am really asking is how to actually "trigger" the action to copy the image to the target table. I have created an "After Update Business Rule" that fires whenever the Picture gets added to the field, but that does not seem to work. I assume it is because the value in the Picture field never changes since everything is happening in the Attachments table.

 

I do not want to create a After Insert BR on the Attachments table.

 

Any thoughts?

 

Miguel

 

 

cloudminus89
Mega Contributor

I managed to do it this way:

located the image on the sys attachment table by searching by file name=icon (as recommended above by Rahul) then table sys id= <the sys id of the record producer>. Clicked into it which auto-downloaded the image, renamed the file extension to .png and was then able to upload it to my new record producer. Et voila!

Amruta12
Tera Contributor