Learning ServiceNow
上QQ阅读APP看书,第一时间看更新

Journals and the Activity formatter

Journal fields technically don't store data in the table that the Journal field is on, but instead, create entries in the Journal Entries [sys_journal_field]table. These journal entries, along with other values corresponding to changes to audited fields from the Sys Audits [sys_audit], History [sys_history_line], and Record History[sys_history_set]tables, are displayed in the Activity formatter.

Journal fields only work on audited tables. Adding such a field will modify a non-audited table's System Dictionary entry so that it becomes audited.

There are three types of Journal fields that you can add to your forms: journal_list, journal, and journal_input.

Journal_list fields don't actually store data, but are used more like formatters. If you visit the dictionary record for a journal_list field (such as when you're creating it), you can navigate to the Advanced view using the Advanced view UI action on the dictionary form. On the Advanced view, you'll see a Dependent Field form section with a Use dependent field check-box in it. Checking this box will reveal the Dependent on field field. Using this method to set the journal_list field dependent on a journal or journal_input field, will cause data entered into the selected field(s) to be shown in the journal_list field.

Examples of Journal fields include the Work notes and Additional comments fields. As you can see in the default Incident form, these fields are combined, and display the list of combined Journal Input fields beneath them. If you have one of these fields on your form, then all other Journal fields will be combined with them into one segment which you can expand to display the fields separately, or select from the select-box below the Journal field(s) to choose which field your input is directed into.

Just like journal fields, journal_input fields allow you to enter notes that can be displayed either in the Activity formatter (if that particular journal input field is tracked), or in a journal_list field. The difference is that if you have only journal_input fields on your form, the inputs will not be combined in a drop-down beneath the input boxes as with Journal fields:

Unfortunately, the Activity formatter is a protected object in ServiceNow, and cannot be directly modified. However, you can customize which tables are audited, and which fields show up in the activity log when modified. Start by clicking the filter icon to the right of the Activity formatter, scroll to the bottom of the list, and click on Configure available fields as shown in the following screenshot:

On the next page, simply double-click, or click to select a field and then click the right-arrow to move it over from the Available column, to the Selected column as shown in the following screenshot:

You'll notice that not only future changes are present, but also any previous changes made to the newly selected field will show up in the activity log!

If your table is audited (which you can determine from the table's record in the System Dictionary), changes are always being tracked in the background. This means that if you make a change to a field that isn't tracked in the activity log (for example, the Category field on the Incident table), and then add it to be tracked in the activity log, any historical activity within that field will be displayed as well.