Setting an image field to the same value as an existing image in db_image
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2024 08:09 AM
For quite some time I've been wondering why it's not default functionality to be able to browse db_image when using image field types.
So I've been experimenting with setting the same sys_id as the image on the db_image record.
Which seems to work just fine! If the image in the db_image record changes, the other one changes too. Sounds like a great way to maintain icons and illustrations and keep things centralized and tidy.
However, when we do that we loose the [Update][Delete] buttons under the image.
Because the formatter most likely checks if the current record "owns" the sys_attachment. And the [update] and [delete] buttons deletes the actual sys_attachment record. So obviously we can't do that.
If I manually set the value to '' using server script, it doesn't clear the displayValue, only value. So the old reference is still there, even though the value technically is blank.
Has anyone else experimented with this? It's an absolute pain to maintain icons for hundreds of catalog items when they have their own isolated icons in sys_attachment. Would be much cleaner to govern image libraries centrally and just reference an already existing image.