The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Creating a comment/work note through sys_journal_field not displaying in UI

bscharm
Kilo Explorer

While I understand it is not the best way to create a comment or work note, I am attempting to add a record to the sys_journal_field in order to achieve this. It is POSTing successfully, and I can see the entry when I query the sys_journal_field table. In addition, I can see the entry when I query an incident (the element I am trying to add a comment to) via the API. I have seen others say they can do this successfully (specifically [Solved] Adding comments and work notes via JSONv2) and everything seems to be working except that the comment does not show in the UI. I am sending the following payload-

{

        "element_id":"d71da88ac0a801670061eabfe4b28f77",

        "element": "comments",

        "value": "test creating a comment",

        "name": "task"

}

where the element_id is the sys_id of the incident I am trying to add a comment to. Am I missing something?

2 REPLIES 2

brian_quinn
ServiceNow Employee
ServiceNow Employee

Brad,



Have you used work_notes.getJournalEntry(-1) to verify that the work notes aren't showing up that way? Or are you only using the activity formatter to check?   I believe the activity formatter actually uses sys_audit/sys_history_set/sys_history_line data to build activity history.



Is there a reason you can't add work notes to the incident directly?  


curl -H "Content-Type: application/json" --user username:password --data '{"work_notes":"This is a JSON test"}' 'https://instance/incident.do?JSONv2&sysparm_query=number=INC0000055&sysparm_action=update'



Thanks


Brian


Is there a way to post the comment as if the customer had added it? the comment is being triggered via a change in the CRM and we would like this work notes to show in servicenow as if they were made by the customer