- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-07-2015 06:41 AM
Hi,
In the sys_attachment list, clicking an item in the file name column opens the "Save to" dialog box. Is it possible to reproduce that fonctionality in a custom table where all record contain one attached file ?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2015 09:31 AM
Hello Jacques,
I was doing more testing with this. At the end it wasn't as complicated as I though at first. You have two options (Option 2 is better from my point of view):
Option 1:
Modify the field that you created to be a Reference field to the sys_attachment table.
Change the advanced calculation to:
- var attachment = new GlideRecord('sys_attachment');
- attachment.get('table_sys_id', current.sys_id);
- current.nameOfTheCreatedFiled= attachment.sys_id;
Option 2:
Modify the field that you created to be a Reference field to the sys_attachment table.
Implement a business rule that runs before insert and before update (on your table) to populate the field that you created with the corresponding value:(Actually it would be the same code)
- var attachment = new GlideRecord('sys_attachment');
- attachment.get('table_sys_id', current.sys_id);
- current.nameOfTheCreatedFiled= attachment.sys_id;
Thank you.
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-08-2015 10:14 AM
Thank you very much Edwin.
It works very well.
Have a nice day
