Servicely Administration
Scripting
Journal API
3 min
to use this functionality, you need to be on version 1 10 or later the journal api provide easy access to journal entries, without the need to do complex queries to the underlying table this provides you the ability to get all the journal entries and the details within it (such as who made it and what date time) journal field api function returns description activity() array of journal entry objects returns the entire activity of a journal field (including the date time, user and more)example table('incident', 'inc0000005') clientjournal activity() activity(limit) array of journal entry objects example returns the first third entries table('incident', 'inc0000005') clientjournal activity(3) journal entry apis above return journal entries for a given field, the following methods are available to get data from a single entry function returns description author() string returns the display value of the user that created the entry, usually ${firstname} ${lastname} createdby() user record returns the actual table record of the user that created the journal entry updatedby() user record returns the actual table record of the user that updated the journal entry for convenience, should always be the same as createdby() createdon() datetime returns when the journal entry was created updatedon() datetime returns when the journal entry was updated for convenience, should always be the same as createdon() value()html()entry() string (html) the journal html entry as it is stored text() string (text) the journal entry with html escaped examples table('incident','inc0000005') clientjournal activity(1); // \[{author=admin administrator, createdon=2024 05 21t19 10 44 966+10 00, value=\<p>hello world!\</p>}] table('incident','inc0000005') clientjournal activity(2)\[0] author(); // admin administrator table('incident','inc0000005') clientjournal activity(2)\[0] html(); \<p>hello world!\</p> table('incident','inc0000005') clientjournal activity(2)\[0] text(); hello world!