
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 12:32 PM
I have a before Business Rule and an after Business Rule on my incident table. Both Business Rules need to copy the most recent comments to different tables as part of their logic and use the getJournalEntry(1) function call. I notice the before Business Rule works, but the after Business Rule does not. The after Business Rule copies the last comment previous to the most recent (and results in a blank comment being copied in the case of the first comment entered).
Additionally, I've noticed that if I disable the before Business Rule, then the after Business Rule runs as expected and copies the correct comment instead of the one previous.
Question: Is there an undocumented limitation to the way one can call getJournalEntry(1) in a before and an after Business Rule which results in the scenario described above? Or is this a bug (ahem... enhancement yet to be completed)?
Hoping one of the ServiceNow expert insiders ctomasi, pradeepksharma, joshnerius, dave.slusher can provide a quick confirmation.
In case it matters, I'm on Jakarta version.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 01:25 PM
Hmmm, yeah i get the same result which is unexpected.
However there is a simple solution just change:
gs.warn("DEBUG before BR: " + current.comments.getJournalEntry(1));
to:
gs.warn("DEBUG before BR: " + current.comments);
Since you are in a before BR there is no need to call getJournalEntry as the field has the last value in it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 01:25 PM
Hmmm, yeah i get the same result which is unexpected.
However there is a simple solution just change:
gs.warn("DEBUG before BR: " + current.comments.getJournalEntry(1));
to:
gs.warn("DEBUG before BR: " + current.comments);
Since you are in a before BR there is no need to call getJournalEntry as the field has the last value in it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2017 01:32 PM
That's brilliant! Thank you. I didn't think of that but it works! I had opened a ticket with HI Support but unfortunately they weren't very helpful. They did tell me that what I encountered was essentially an undocumented limitation of the API - but your solution is much better.