How do I script an entry to the comments field from a workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2019 06:10 PM
I am trying to pass a variable into a comments/additional comments of a new incident as part of a workflow >>
gr.setvalue('comments', current.variables.comments);
I can get all my other variables to pass through find, but no luck reaching this field on the incident table. I have tried
Any Suggestions ?
code:
var gr = new GlideRecord('incident');
gr.initialize();
gr.setValue('caller_id', current.variables.caller);
gr.setValue('category', current.variables.category);
gr.setValue('source','website');
gr.setValue('assignment_group',current.variables.assignment_group);
gr.setValue('assigned_to',current.variables.assigned_to);
gr.setValue('location',current.variables.location);
gr.setValue('short_description', current.variables.short_description);
gr.setvalue('comments', current.variables.comments);
gr.setWorkflow(false);
gr.insert();
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2019 09:59 AM
To add to the comments/work_notes you want something like this:
gr.comments.setJournalEntry(current.variables.comments);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-18-2019 10:00 AM
Hi,
Can you try with the following method? Pass the hardcoded value first to test and then try passing variable comments.
gr.comments= "Test";
(Or)
gr['comments'].setJournalEntry("Test");
Let me know how that works.
Thanks,
Raghu.