- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:28 AM
Hello,
What is wrong with the below client script?
The sys_id shows up correctly, but nothing else appears.
Table: Change Request
Type: onLoad
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:47 AM
HI @DoDo labs___ ,
You should be writing this server side script either in script include or business rule, for this requirement you can create a display business rule and use g_scratchpad to send the latest work notes to client side and then display it as alert, please follow these steps:
Step 1: create a display business rule on change_request table
Use this script:
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.workNotes = current.work_notes.getJournalEntry(1);
})(current, previous);
Step 2: Update your client script and make these changes:
function onLoad() {
alert(g_scratchpad.workNotes);
}
If my answer has helped with your question, please mark it as correct and helpful
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:35 AM
Hi,
function onLoad() {
var sysid = g_form.getUniqueValue();
alert(sysid);
var x = new GlideRecord('sys_journal_field');
x.addQuery('element_id', sysid);
x.addQuery('element', 'comments');
x.query();
if (x.next()) {
var fieldName = x.getValue('element');
alert(fieldName);
}
}
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:36 AM
But based on that you can use Script include
Thanks,
Rahul Kumar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:54 AM
Thanks for your quick reply, but still no work notes showing up 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-23-2023 10:47 AM
HI @DoDo labs___ ,
You should be writing this server side script either in script include or business rule, for this requirement you can create a display business rule and use g_scratchpad to send the latest work notes to client side and then display it as alert, please follow these steps:
Step 1: create a display business rule on change_request table
Use this script:
(function executeRule(current, previous /*null when async*/) {
g_scratchpad.workNotes = current.work_notes.getJournalEntry(1);
})(current, previous);
Step 2: Update your client script and make these changes:
function onLoad() {
alert(g_scratchpad.workNotes);
}
If my answer has helped with your question, please mark it as correct and helpful
Thanks!