- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2018 07:04 PM
Hello,
I would like to capture the last work note or comment on a task. My business would like to use these fields for reporting purposes. I currently have a business rule setup to capture those fields by using the code below. This is an after Business Rule on update/insert:
function executeRule(current, previous /*null when async*/) {
current.u_last_comment = current.comment.getJournalEntry(1);
current.u_last_work_note = current.work_notes.getJournalEntry(1);
//current.u_entered_by_comments = current.comments.
})(current, previous);
I'm not sure what's wrong here. The u_last_comment and u_last_work_note were both setup initially as Strings, but I changed them to Journal just in case there was a variable mismatch. Still no luck. Any ideas on what to do here?
Also, I wanted to see if I can grab the "Entered By" and "When" of the last work note/comment as well. Is there any functions I can use to get that data as well?
Thank you!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2018 07:14 AM
I'm glad I was able to assist you with getting that to work successfully.
When pulling the last journal entry...doesn't it say in that the name of the person and the date/time? It does for me.
But you could at the same time, use current.updated_by and place that somewhere as well which pulls who did it and then use current.sys_updated_on to get the date/time.
Please mark my other reply as Helpful and this one as Correct if this helps you solve it.
Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2018 09:16 AM
That's it. I updated the comments and at least got some data to come out from the logs. However, on the form, I'm still not able to find any data displaying, nor in the .XML.
Also, Is there any sort of way to get that Entered By or When data though? We would like this data for reporting purposes again.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2018 09:22 AM
just confirming here.
the field you have used to updated the comment , is that correct name eg: u_last_comment ?
Lets troubleshoot.
current.description= "comment is:"+current.comments.getJournalEntry(1) + ' *****' + "work notes :" +current.work_notes.getJournalEntry(1);
can you just give a try if its updating an description field or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2018 09:44 AM
Yes all the names I have for my variable are correct here. I tried the troubleshooting step you suggested here and the Description field is not displaying any information.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2018 09:52 AM
For the sake of just seeing what happens...change business rule to before.
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2018 12:07 PM
I have gotten the business rule to capture the last work note successfully now. However, I'm still looking for a way to get the Date Entered, and "Entered By" to populate. Any ideas?