setJournalEntry not working correctly, in many ways
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 01:59 PM
setJournalEntry is behaving inconsistently for us when running a script that mass closes and appends a journal entry to a chosen list of tasks; at times it will work correctly, at others we are seeing three incorrect behaviors for setJournalEntry:
- No entry appears at all in Activities, but does appear in sys_journal_field
- The string value provided for the Username is ignored and username of user that ran the script is entered instead.
- Entry is shoehorned somewhere in the middle of the Activity, with a user and timestamp associated with Update 0 in the History List, instead of the correct information in the sys_audit table
We are setting setUseEngines to false to prevent some of our automated behaviors from occurring instead of setWorkflow, as setJournalEntry doesn't even work when we use setWorkflow.
EDIT/UPDATE
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 02:14 PM
Hi Yvan,
If you are setting the Journal Entry (sys_journal_field) directly then it probably won't show up in the activity stream of the ticket. I believe the activity formatter takes its information from another table (think its sys audit table but could be wrong) so setting it directly does not create an entry in this table.
You will get a full set of entries if you update the journal field directly in the ticket itself i.e. current.work_notes = "Your relevant comment";
Hope this helps,
Brent
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 02:17 PM
I was under the impression that setJournalEntry was meant to emulate entering information manually, the script is meant to mass close 1000+ tasks, so manually entering a work note wouldn't really work for us.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 02:19 PM
After some additional investigation the sys_audit table shows the correct information for all of the edited tasks.
However the Activity stream and History List are showing completely erroneous information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2018 02:31 PM
Hi Yvan
I believe the activity formatter takes information from a number of tables to display on the ticket. A quick search suggests the activity formatter uses the following tables - Sys Audits [sys_audit]
, History [sys_history_line]
, and Record History[sys_history_set]
.
It will be hard to retroactively populate all these tables with the correct information.
Probably best to clear the slate and start again.
Brent
P.S. If you found this information useful then please mark as Helpful.
After some additional investigation the sys_audit table shows the correct information for all of the edited tasks.
However the Activity stream and History List are showing completely erroneous information.
Original script was run in a subprod and all tested tasks looked perfect there. Only after running this in production instance did things go completely sideways.