what is the best and safest way to copy emails ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hello,
I've created a UI action on "sn_customerservice_case" table to duplicate cases.
the ui action copy all field from parent case , and set it as a parent of the copied one.
i would like to copy all emails ( or display them in the child case)
what is the best approach ?
thank you in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
@ammar_k ,
Safest and most maintainable way to copy emails when duplicating a case is to explicitly copy the related sys_email records and link them to the new case rather than trying to rely on the activity stream auto linking, because oob snow doesn’t automatically propagate emails from one case to another when you clone a case record and......attachments or email entries need to be manually duplicated, so you would capture the parent case sys_email records in your ui action or in an after insert business rule.......use GlideRecord to query the sys_email entries related to the parent case, and then create or copy new sys_email records for the child case while maintaining the correct target and activity references...... typically using GlideSysAttachment.copy() for attachments if needed, and ensuring the logic runs after the new case has been inserted so the new case sys_id is available for linking,.....because simply copying fields on the case won’t include the email history or activity stream without that explicit script or flow handling.......
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Technical Consultant - ServiceNow Class of Legends 2025
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @ammar_k ,
In real projects, the safest approach is not to copy emails at all. Even though emails appear in the activity stream, they are stored in the sys_email system table and are closely connected with inbound and outbound email processing, notifications, and audit history. Cloning these records usually leads to more problems later, such as threading issues, audit confusion, and upgrade challenges.
What we usually do instead is:
- Keep the emails on the parent case.
- Show them on the child case (related list, formatter, read-only view filtered by parent).
This provides full visibility without duplicating system data, and it’s much easier to maintain in the long run. If the business really insists on having a separate email history for the child case, then:
- Do it after insert (once the new case exists).
- Query the parent case emails from sys_email.
- Create new sys_email records for the child (never update existing ones).
- Copy attachments separately using GlideSysAttachment.copy().
- Ensure you’re not re-triggering outbound emails.
But unless there's a compliance reason, I’d avoid copying sys_email altogether.
If you found this useful, please mark it as Helpful and Accepted.
-- Ankit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hello, thank you for your reply.
Could you please provide some high-level steps on how to do this:
“Show them on the child case (related list, formatter, read-only view filtered by parent).”
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @ammar_k,
Sure, let me share a few practical ways to handle this
Option 1: Related List (simplest)
Add a related list for Emails (sys_email) on the child case
Filter it using the parent case reference
This gives full visibility without duplicating any data
Option 2: Read-only Formatter / UI Macro
Create a formatter or UI macro
Query sys_email records related to the parent case
Render them in read-only mode on the child case form
Option 3: Workspace / Portal (if applicable)
In Workspace, use a custom component or data resource
Fetch emails linked to the parent case and display them inline
But in all cases, the core idea is the same:
reuse the parent case’s email records and surface them on the child, instead of cloning system data.
This keeps the audit history intact and avoids issues with email threading and upgrades.
Hope this helps clarify the approach.
If you found this useful, please mark it as Helpful and Accepted.
- Ankit
linkedIn : https://www.linkedin.com/in/sharmaankith/
