- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2015 05:31 AM
I'm working on email notifications in a Scoped Application...
One of the common things we do in our notifications is send the last 3 entries in Work notes or Comments. As these are journaled fields I've always used .getJournalEntry() to return the entries in the Journal.
Unfortunately, this method is no longer allowed in scoped applications. I checked the Wiki for the scoped solution and didn't find one.
Any ideas how to make this work in a scoped application?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2015 07:36 AM
Hi Robert,
For scoped applications, you have to query the table "sys_journal_field" based on element_id(sys_id of the record) to fetch the values.
Please let me know if you have any questions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2015 07:36 AM
Hi Robert,
For scoped applications, you have to query the table "sys_journal_field" based on element_id(sys_id of the record) to fetch the values.
Please let me know if you have any questions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-24-2015 09:12 AM
Pradeep got me pointed in the right direction...unfortunately this is terribly clunky to implement in email notifications, as it's going to really require that you build a Script Include method to provide re-use, but this is the basis of the code I'm going to be implementing:
// We have a system property that is set to limit the number of comments / work notes in email notifications
var sysID = '000ae5066fb7f500291a33d9ea3ee4d4'; // used for testing purposes
var journalLengthProp = gs.getProperty('comment.journalLength');
var journalLength = 1;
if (journalLengthProp != null) {
journalLength = journalLengthProp;
}
var gr = new GlideRecord('sys_journal_field');
gr.addQuery('element_id',sysID);
gr.addQuery('element','comments'); // Only grab comments, not work notes
gr.setLimit(journalLength); // Limit the return rows
gr.orderByDesc('sys_created_on'); // Order with most recent at the top
gr.query();
while (gr.next()) {
gs.print(gr.sys_created_on+': '+gr.value);
}
Enjoy! Thanks Pradeep.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2016 03:42 PM
Hi robpickering,
Looking to do the same thing for a scoped application and would be interested to know what your final solution was to get the comments into the email.
Thanks,
Jonathan