How to query on work notes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 08:49 PM
Hi all,
I need to delete custom table records after 1 year from closure if the work note does not contain few keywords such as 'abc', 'xyz' etc.
I am unable to query on work_notes field as its a journal input field.
How to add OR conditions in work_notes field?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2022 09:05 PM
Hi,
journal data is stored in sys_journal_field table
you can query your custom table and then check in sys_journal_field for work_notes column
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 08:13 AM
Thanks
My requirement is to delete the closed records after 1 year if the work notes, description or short description does not contains the words 'abc' or 'xyz'.
I think a scheduled job is the best approach but I am confused on the script, can you help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2022 09:13 AM
Hi,
yes monthly or weekly scheduled job should be fine
Steps
1) Query table with description or short description does not contain abc or xyz and created 1 year ago
2) Iterate and query in sys_journal_field for this record sys_id against work_notes and check if it contains abc or xyz
3) if yes then delete
You can also use flow designer with no scripting involved
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2022 11:31 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped you please mark it correct to close the question so that it benefits future readers as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader