- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 11:38 AM
Hello,
We have a text field, and we want to copy the contents of the text field to a new journal input field. We have a journal list field to display the contents of the journal input field. We want a separate journal input and journal list field as the information entered is sensitive.
Old text field: u_ncpi_information
New journal input field: u_ncpi_information_journal
New journal list field: u_ncpi_information_list
I created a background script to do this, however, the journal list does not show the update. I tried several different code variations, but no luck.
//move data from 'old' NCPI field (u_ncpi_information) to new NCPI Information Journal field
var count = 0;
var inc = new GlideRecord('incident');
inc.setLimit(1);
inc.addQuery('u_ncpi_information','!=','');
inc.query();
while(inc.next()) {
inc.u_ncpi_information_journal = inc.u_ncpi_information;
inc.setWorkflow(false);
gs.print(inc.number);
count = count + 1;
inc.update();
}
gs.print(count);
Any ideas?
Thank you,
Laurie
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 11:49 AM
Hello Laurie,
Try
inc['u_ncpi_information_journal'].setJournalEntry(inc.u_ncpi_information); instead of inc.u_ncpi_information_journal = inc.u_ncpi_information;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 11:49 AM
Hello Laurie,
Try
inc['u_ncpi_information_journal'].setJournalEntry(inc.u_ncpi_information); instead of inc.u_ncpi_information_journal = inc.u_ncpi_information;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 12:24 PM
Thanks, Pradeep!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 01:11 PM
Hi Pradeep,
Question - what do the "[" and "]" symbols mean in the code you gave me?
Thanks,
Laurie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 01:27 PM
Hello Laurie,
You can write inc['u_ncpi_information_journal'] OR inc.u_ncpi_information_journal //Here u_ncpi_information_journal is the field column name