- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2023 04:56 AM - edited ā09-21-2023 04:56 AM
Hi
I have following requirement.
There is a journal input field called worknotes on my form.
How to display last updated worknotes on the workspace instead of worknotes activity for a requestor?
How to add the last updated comment/worknote in notification body?
i have added
worknote: ${worknotes}
since it was taking the whole worknote activity.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2023 05:11 AM
Hi @sony8,
I'm not completely sure about the use case to only display the last one in the workspace, but you could accomplish that by creating a new string field (u_last_worknote).
Create a display business rule which fills a scratchpad value with the last comment.
function(current) {
g_scratchpad.lastWorknote = current.work_notes.getJournalEntry(1);
})(current);
And a onLoad Client script:
if (g_scratchpad.lastWorknote){
g_form.setValue('u_last_worknote', g_scratchpad.lastWorknote);
}
It might also work if you set the calculated field on the dictionary entry of (u_last_worknote) to true and set this script in the calculation field, however this is untested.
return current.work_notes.getJournalEntry(1)
For the notification you can use the same logic in an email script:
<mail_script>
var worknotes = current.work_notes.getJournalEntry(1);
template.print(worknotes );
</mail_script>
// Or for comments
<mail_script>
var comments = current.comments.getJournalEntry(1);
template.print(comments );
</mail_script>
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-21-2023 05:11 AM
Hi @sony8,
I'm not completely sure about the use case to only display the last one in the workspace, but you could accomplish that by creating a new string field (u_last_worknote).
Create a display business rule which fills a scratchpad value with the last comment.
function(current) {
g_scratchpad.lastWorknote = current.work_notes.getJournalEntry(1);
})(current);
And a onLoad Client script:
if (g_scratchpad.lastWorknote){
g_form.setValue('u_last_worknote', g_scratchpad.lastWorknote);
}
It might also work if you set the calculated field on the dictionary entry of (u_last_worknote) to true and set this script in the calculation field, however this is untested.
return current.work_notes.getJournalEntry(1)
For the notification you can use the same logic in an email script:
<mail_script>
var worknotes = current.work_notes.getJournalEntry(1);
template.print(worknotes );
</mail_script>
// Or for comments
<mail_script>
var comments = current.comments.getJournalEntry(1);
template.print(comments );
</mail_script>
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.