Copy comments and work notes history from INC to Case

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 08:57 AM - edited 09-14-2023 08:58 AM
Hi all!
Hope someone has an idea on this...
We are in the process of implementing Case management and we want to migrate incident data to cases. The part I'm stuck on is moving historical comments & work notes from incident to case. They are in the sys_history_line table and we can copy them but the sys_history_set seems to be a moving target.
Any ideas on how I can essentially copy the history from the incident to the case, specifically just comments and work notes?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 09:06 AM
Hi @Community Alums,
You may want to use this on your existing script:
current.comments.getJournalEntry(-1); //gets all comments on record
current.comments.getJournalEntry(1); //gets just the last comments entry on the record
This is for all journal-type fields, so work_notes will behave the same too.
If my response helps to solve your issue. Kindly mark it as helpful & correct. It will be helpful for future readers! 👍
Thanks,
Marcos Kassak
The world works with ServiceNow!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-19-2023 08:02 AM
Hi Marcos,
Thanks for the reply. The data was brought over but since I ran this in a Fix Script logged in as myself, the comments show as if I made the comment; not the original person. I was hoping to retain the original author of the comment/work note.
Thanks,