Modifying a journal field before insert or update

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2011 05:39 AM
Hello,
I am trying to modify the comments (which is a journal / journaled field) inserted by a user into a task in some situations.
For that I have created a business rule of type "before" and "insert/update".
In the script of the business rule I do something similar to:
if (!gs.nil(current.comments)) { current.comments = current.comments + " additional text here"; }
The problem is that this does not modify the comment being inserted, but rather adds another comment. So if the user wrote "hello", we will have 2 comments:
hello additional text here hello
I have searched the wiki and the forums and I have not found any easy way to do this. The only solution I can imagine is to delete the delete the older record from the sys_journal_field table but it would have to be done very well to not to delete the wrong comment.
Does anyone have any suggestion / ideas? 🙂
Thanks in advance,
David

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2011 07:32 AM
dmartinc
Man, I wish I would've thought outside the box on that! Such a simple solution, IMO. Good call by your colleague. Thanks for posting your final solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2023 09:30 PM
Hi dmartinc
I tried same script what you have given, its working on sys_journal_field table (value is updating as expected), however its not reflecting in the task or incident table.
Is your script still working?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 05:54 AM
Dear @Kishore T K
The thread started in 2011, almost 12 years ago! Time flies.
Unfortunately since then I have moved to another position. So I cannot tell you if the script is still working or not.
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2023 06:04 AM
Have a look at knowledge article How to delete a Comment or a Work Note from a record to see what needs to be modified to successfully update a comment (update the journal entry, update the journal audit entry and rebuild the history set).
The title suggests it is a solution for entry deletion, but it is in fact for updates too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2015 05:42 PM
An "On Submit" Client Script would do the trick.
e.g.
function onSubmit() {
//Add to the entered comments
var theComments = 'Additional Text Here\n-------------------\n' + g_form.getValue('comments');
g_form.setValue('comments', theComments);
}
Saves playing with the sys_journal table.