
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2018 11:49 AM
HI,
I'm using a ui action and use current record information to create a new record. The initial form includes an image field and I'd like to copy the image to the new field ...
....
gr.u_new_image_field = current.u_image_field; does not work for image fields .. is there an easy way to do that?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018 12:57 PM
var ids = GlideSysAttachment.copy('ZZ_YYsc_cat_item','current.sys_id','ZZ_YYsc_cat_item','destinationsys_id');
var gr = new GlideRecord("sys_attachment");
gr.addQuery("sysid", ids);
gr.query();
if (gr.next()) {
gr.setValue('file_name', 'u_icon.jpg');
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2018 01:15 PM
Images are stored on attachment table so you have to query sys_attachment table to copy it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2018 01:40 PM
... ok. Thank you.
I can find the image on the sys_attachment via the record sys_id and the field name .. , but how to I COPY the image to the new field ... ?! Could you please show me an example scripting for that?!
Big thnx!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2018 03:49 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2018 07:42 AM
this will copy the attachments - but I have a field that is containing the image like sc_cat_item.picture ...
How to copy the picture from one cat item to an other? Not linking to it but creating a duplicate that then belongs to the other item ...