Posting comments via REST API and getting their sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 06:42 AM
Hello!
From what I understand, the only way to post comments via the REST API is by editing the comment/work_notes field of the parent object in the adequate table (incident, problem, case etc.), and simply adding entries to sys_journal_field does not work. My question is, once I post the comment this way, what is the best and most accurate way to retrieve the posted comment id from the sys_journal_field table? My worries are namely that if I for example query by element_id and order by descending date of creation, there is still the possibility that another comment has been posted at the same time of after I posted my comment and I am getting the wrong comment id. Is there a good way to add the comment body to this query of the sys_journal_field table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 12:00 PM
Hi, I am not really sure I have understood your issue\question.
Regardless of whether you are updating from an external system, or have 2 users updating your instance from within SNC platform, the order of records when sorted by sys_created_on will always be the order in which the updates were inserted into the platforms underpinning data base (and this should be your only source of truth for timestamps).
Can you clarify why the system post\put\patching to the journal would then need to be retrieved in a different\separate query from the REST response message?
For any other integration I would expect your SNC instance to push out any update on insert, regardless of whether you update the task record or journal direct. If using a GET from another platform then you would retrieve all updates since the last 'GET' and SNC timestamps would be the source of truth regarding when the updates were made to the platform.
Pushing records directly to journal may result in the updates not being directly visible in the related record\task,
this has also been a previous issue with SNC (although it seems to work as expected if I test in a PDI) and SNC recommend that you use a transform when updating journal entries
I also consider it best practice to use transform for integrations, as it ensures the integrity of your SNC data and provides some level of auditing, which a direct REST update may not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 03:54 AM
Can you clarify why the system post\put\patching to the journal would then need to be retrieved in a different\separate query from the REST response message?
I think I need to do this because I want to get the id of the created comment after I've added it to, for example, an incident by editing the comments or work_notes field, and the API response when sending a PUT/PATCH request to the incident table is only the edited incident object, not the comment that was created in sys_journal_field. This is why I would also have to look up the latest comment created in sys_journal_entry for the incident I just edited.
Pushing records directly to journal may result in the updates not being directly visible in the related record\task,
this has also been a previous issue with SNC (although it seems to work as expected if I test in a PDI) and SNC recommend that you use a transform when updating journal entries
Yes I encountered this issue, I used the Table API to add items to the sys_journal_field table and they did not show in the UI for the element I was linking them to. I was looking at these transform map options but I was unable to set this up in my instance. Could you please point me to some resources on transforms and proper integrations via REST API? The main thing is that I would like to be able to accomplish all of this only via the REST API, without having access to the UI of the instance I am working with.
How can I make sure that when I am using the API to add an entry to journal it is also displayed in the related record, while only having access to the API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2024 11:12 AM
"because I want to get the id of the created comment after I've added it to"
I would strongly recommend against deletion or editing of records in the journal table,
Editing\deletion will have a detrimental impact to the integrity of your audit data and deletion of any record\update wit in the platform (that is not BAU functionality) is not best practice. As a process this may also cause confusion as functionality triggered by the insert would still have run IE notifications, flow\workflow, task_sla updates etc.
Transforms are part of the import set process and information is available.
'How can I make sure that when I am using the API to add an entry to journal it is also displayed in the related record, while only having access to the API?"
As detailed in KB0623936, there is a known visibility issue which may impact direct updates to journal table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 12:16 PM
From what I understand, the only way to post comments via the REST API is by editing the comment/work_notes field of the parent object in the adequate table (incident, problem, case etc.), and simply adding entries to sys_journal_field
That isn't clear. What are you trying to do? And are you encountering a problem?