Should we extend the sys_attachment table ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 05:47 PM
Hello,
I want to create a new table and incorporate certain columns from the sys_attachment table. However, I am unsure whether it is considered a best practice to extend the sys_attachment table. Are there any potential impacts or drawbacks associated with doing so?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 06:09 PM - edited 12-13-2023 06:09 PM
Hi @Duc Vu Hoai ,
It's generally not considered a best practice to directly extend the sys_attachment table in ServiceNow. While it might seem like a quick solution to include specific attachment information in your new table, there are potential drawbacks and impacts to consider.
Here's why extending sys_attachment isn't ideal:
Data integrity concerns: Modifying core tables can lead to data integrity issues, especially when upgrading or applying updates. Changes might break existing functionality or dependencies.
Performance implications: Adding more columns to a heavily used table like sys_attachment can affect performance, impacting your entire instance.
Maintenance complexity: Customizing core tables makes future upgrades and maintenance more challenging. You'll need to manually port your changes to new versions.
Limited flexibility: Extending sys_attachment restricts you to its predefined structure and workflow. You might need to write additional scripts to handle specific data manipulation or logic.
Instead of directly extending sys_attachment, consider these alternative approaches:
Use reference fields: Create reference fields in your new table that point to records in the sys_attachment table. This allows you to leverage the existing functionality and structure of sys_attachment while keeping your data separate.
Create a custom related table: If you need more control over the attachment data and workflow, consider creating a dedicated table related to your new table. This gives you greater flexibility and avoids modifying core tables.
Utilize existing modules: ServiceNow offers various modules like File Attachments and Document Management that provide attachment functionality. Consider using these modules instead of modifying the sys_attachment table.
Documentation:
- ServiceNow recommends against modifying core tables like sys_attachment. Refer to the following documentation for best practices:
- Extend vs. Customize: https://docs.servicenow.com/
- Customizing core tables: https://www.servicenow.com/community/developer-forum/servicenow-definition-of-customization-and-conf...
Please mark ✅ Correct if this resolves your issue, and also mark 👍 Helpful if you find my response valuable based on its impact.
Regards,
Astik Thombare
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2023 06:25 PM - edited 12-13-2023 06:26 PM
Hello Astik,
I apologize for any confusion. Allow me to clarify: I want to create a new customized table, and this table will inherit from the sys_attachment table by extending it. Not create new columns in sys_attachment table