Follow-up question - Remove prefix from table name in sys_attachment table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2025 09:21 AM
Hi @Ankur Bawiskar.
This is just a follow-up question regarding the script below you posted in https://www.servicenow.com/community/itsm-forum/remove-prefix-from-table-name-in-sys-attachment-tabl.... You asked me to created a new post since this was an old thread.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr = new GlideRecord("sys_attachment");
gr.addQuery("table_name", "ZZ_YY" + current.getTableName());
gr.addQuery("table_sys_id", current.sys_id);
gr.query();
if (gr.next()) {
gr.table_name = current.getTableName();
gr.update();
// new global.VariableUtil().copyAttachment(gr.sys_id, current.getTableName(), current.sys_id);
}
})(current, previous);
Do you know why this line of code is commented for "sc_req_item" table and the attachments still show up on attachment list on top of the record whereas the same line of code needs to be added for "sn_hr_core_case" table for the same reason? Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-23-2025 07:37 PM
I will have to test it out when time permits.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2025 09:23 AM
@Ankur Bawiskar - Thank you and I'm looking forward to your test results.