Inserting images into an HTML field attaches the images to the current record table
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2023 07:26 AM
Hi All,
Inserting images into an HTML field attaches the images to the current record table,how to restrict this behavior
Regards,
Jobin
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-07-2023 01:25 AM
Hi,
You can create a After Insert business rule on sys_attachment table that should run only for your custom table.
You can add below script:
(function executeRule(current, previous /*null when async*/ ) {
var recordId = current.table_sys_id;
var fileName = current.file_name;
var attachmentid = current.sys_id;
var grVar = new GlideRecord('table_name'); // replace your table name here
grVar.addQuery('sys_id', recordId);
grVar.query();
if (grVar.next()) {
var attachImage = '<p><img src="/sys_attachment.do?sys_id=' + attachmentid + '"/></p>';
grVar.u_html_field = attachImage;
grVar.update();
}
})(current, previous);
Make sure your BR only runs for your table and attachment is of type image (use correct when to run condition to avoid running it for other type of records)