I'm trying to capture the metadata of work notes for an sc_task in ServiceNow, so I'm posting work notes directly to sys_journal_field. However, I'm running into an issue where the work notes don't appear in the UI until a field on the task is modified. Has anyone encountered this, and if so, is there a way to ensure the work notes display in real-time without having to change a task field?
When I tried updating a field on the task, the work notes started reflecting on the task. Until then, the work notes were not visible on the task, although newly posted comments were appearing in Postman.
There are actually 3 tables you have to change to make updates directly to sys_journal.
I'd recommend setting the table field that's the journal field, so instead of inserting into sys_journal, just update <your_table>.<journal_field> and it will make the updates for you.
However, if you must do it your way for some reason, read this article:
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0520375
The article does not actually cover inserting new records, it's only about modifying/deleting records. You will have to play with it some, but if I were trying it I'd insert into the journal, then (maybe) insert into the audit entry field, and delete the cache records so they rebuild when needed.
Actually, I'd do what I said first and update the table field, but this is the best I've been able to find - here's an excerpt from the article:
Update the Journal Entry: Enter the journal entry URL + the sys_id. For example: https://.service-now.com/sys_journal_field_list.do?sysparm_query=element_id=85befb1c4a34bb12013b216a9fd5fee8 Locate the journal entry. Modify the record and update or delete the record.
Update the Audit Entry: Enter the audit entry URL + the sys_id. For example: https://.service-now.com/sys_audit_list.do?sysparm_query=documentkey=85befb1c4a34bb12013b216a9fd5fee8 Locate the audit entry. Modify the record and update or delete the record.
Rebuild the History Set. This is only required when you do not use direct auditing and the System Property [glide.sys.activity_using_audit_direct] is set to false (= default value (this is the value used if the System Property does not exist on the instance).
Locate all History Set records for the item whose history needs to be rebuilt by entering the history set URL + the sys_id. For example: https://.service-now.com/sys_history_set_list.do?sysparm_query=id=85befb1c4a34bb12013b216a9fd5fee8
Click the Delete button for each History Set. This will delete the History Set, not the audit data. The History Set will be rebuilt with the corrected audit and journal information as soon as a user views the item.