The CreatorCon Call for Content is officially open! Get started here.

What is the quickest way to retrieve all additional comments and work notes on a catalog task

Anubhav24
Mega Sage

Hi All,

 

We usually have catalog tasks that have multiple comments and work notes and also comments on RITM , I know we can GlideRecord or use current method to access these few fields but what is the quickest and most efficient method to achieve this.

In addition to this I also need to know to what all assignment groups the task was assigned along with the current one.

For this again we can use Metric Instance table but is it the most efficient way or should I refer to sys_history_line , not sure if this history line table stores all old values.

 

Thanks in advance

3 REPLIES 3

Kieran Anson
Kilo Patron

You can read more about History Sets in this knowledge article. But in short, they're not the best mechanism to access historical information programmatically as they may not exist. 

 

sys_journal_field can be queried for journal entries (comments and work notes) but that doesn't solve your query around historic assignment group information.

 

ServiceNow provide the HistoryWalker API that efficiently allows you to walk backwards and retrieve historic gliderecord values. As long as the table is audited, you can walk backwards and find values based on the mod count.

 

https://developer.servicenow.com/dev.do#!/reference/api/xanadu/server/sn_hw-namespace/HistoryWalkerS...

 

Thanks a lot for your reply.

Historic group I think metric_instance is the only option , however for accessing sys_journal_field with specific sys_ids do you think it will take time or is it an efficient way to query all comments and notes for a particular task.

Querying sys_journal_field using the indexed columns can be efficient. Just ensure you're always passing in the referenced record the journal values belong to, and not solely querying on the data columns