Should we extend the sys_attachment table ?

Duc Vu Hoai
Tera Guru

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

2 REPLIES 2

Astik Thombare
Tera Sage

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:

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

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