- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 12:12 PM
This might be simple but I have never had to work with journal entries before. I was wondering if they behave differently that normal string fields. Here is an example/problem I am facing:
I would like to update the Work Notes field but am having no success. Eventually this will be run from a workflow script but currently I am testing this in a business rule.
var info = 'data';
var gr = new GlideRecord('table name here');
gr.initialize();
//see below
gr.insert();
gr.update();
Below are the multiple way I have tried to insert data into the work notes field with zero luck.
gr.setValue('work_notes', info);
gr.setValue('work_notes', 'data');
current.work_notes = info;
current.work_notes.SetJournalEntry(info);
If anyone could tell / explain to me what it is that I am doing wrong would be really helpful.
Thank you.
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2017 12:15 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2018 07:12 AM
instead of using
gr.setValue('work_notes', 'data'); //setValue does not work for field of type journal input
you can use
gr['work_notes'] = 'data';
This last syntax is especially useful when 'work_notes' is contained in a variable.
Exemple
var fieldName = 'work_notes';
gr[fieldName] = 'data';
Ximizu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-08-2022 07:57 PM
Simply assign the value directly but make sure to make it a string.
inc.work_notes = value + "";
or
inc.work_notes = value .toString();
Regards,
Nayan