I want to copy the contents of Activity Formatter to another table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 05:01 PM
I want to copy the record update history and Worknotes posting history displayed in Incident's Activity Formatter directly to custom table A.
I understand that the contents of Activity Formatter are stored in the following four tables, but even when I create the process, they are not copied to Activity Formatter in custom table A.
How can I achieve the above requirement?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-21-2025 10:44 PM
Hi
@MiY
Solution: Enable Activity Formatter on Custom Table A
Step 1: Add Activity Formatter to Form of Custom Table A
Go to Custom Table A form layout.
Right-click the form header → Configure > Form Layout.
In the left column (Available), find Activity Formatter, and move it to the right (Selected).
Save the layout.
This adds the formatter to the form, but it still needs data to show.
Step 2: Configure Journal Fields on Custom Table A
Ensure that Custom Table A has fields similar to work_notes, comments, or others that the Activity Formatter expects.
Go to the Table definition (System Definition > Tables)
Open Custom Table A
Make sure it has fields of type Journal or Journal Input like:
work_notes (Internal)
comments (External)
If not, create them:
Name: work_notes, Type: Journal
Name: comments, Type: Journal
This is required so the Activity Formatter knows what to show.
Step 3: Copy Data from Incident to Custom Table A
Now, you need to copy both:
Entries from sys_journal_field
Entries from sys_audit (if you want to copy field change history too)
Script Example to Copy sys_journal_field:
var gr = new GlideRecord('sys_journal_field');
gr.addQuery('element_id', 'incident_sys_id_here'); // replace with actual Incident sys_id
gr.query();
while (gr.next()) {
var newJournal = new GlideRecord('sys_journal_field');
newJournal.initialize();
newJournal.name = 'custom_table_a'; // table name
newJournal.element_id = 'custom_table_a_sys_id_here'; // record in custom table
newJournal.element = gr.element;
newJournal.value = gr.value;
newJournal.sys_created_by = gr.sys_created_by;
newJournal.sys_created_on = gr.sys_created_on;
newJournal.update();
}
Repeat a similar process for sys_audit if needed.
Optional: Use Data Policy or Scripted REST API
If you're copying data regularly (e.g., via flow or automation), consider using:
Flow Designer (copy journal fields on update)
Script Include or Scheduled Job