- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2020 03:29 AM
Hi ,
am using business rule to capture the current work note as below code ,But requirement is when work note updated than only have to capture the work note and send to 3rd party tool .please guide me
current.work_notes.getJournalEntry(1)
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2020 05:52 AM
You can have condition in BR
current.work_notes.changes()
To get the latest work notes value use this
current.work_notes.getJournalEntry(1)
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2020 04:25 AM
Basically you want to get the record that was before that,I think you have write a script like below
var grInc = new GlideRecord('sys_journal_field');
grInc.addQuery('element_id',current.sys_id); // Adding filter to find current incident
grInc.addQuery('element','work_notes'); // Adding filter to fetch only Worknotes
grInc.addQuery('value','!=',current.work_notes.getJournalEntry(1));
grInc.orderByDesc('sys_created_on');
grInc.query();
if(grInc.next())
{
gs.info(grInc.value);
}
This script will give you the previous record .
If you want to test in background scripts use below
var grInc = new GlideRecord('sys_journal_field');
grInc.addQuery('element_id','471bfbc7a9fe198101e77a3e10e5d47f'); // Adding filter to find current incident
grInc.addQuery('element','work_notes'); // Adding filter to fetch only Worknotes
grInc.addQuery('value','!=','WW');
grInc.orderByDesc('sys_created_on');
grInc.query();
if(grInc.next())
{
gs.print(grInc.value);
}
Regards
Pranav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2020 04:54 AM
Hi ,
when we are using current.work_notes.getJournalEntry(1)
iam getting output as :06/12/2020 12:46:34 - User name (Work notes)
test7
But my work note is :test7 (getting additional string like time and user name ),is tehre is way to eliminate and print only work note value .!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2020 05:00 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2020 05:17 AM
okay, In sys_journal_field table values are test 6
but when iam fetching from current.work_notes.getJournalEntry(1) iam getting 06/12/2020 12:46:34 - User name (Work notes) test6
So in the above script validations are not happen as expected .!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-06-2020 05:44 AM
Hi
Iaam going to trim my wroknote and send that value to the above script and it works thanks for ur help