How do I script an entry to the comments field from a workflow?

CW Peters
Kilo Explorer

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();

 

2 REPLIES 2

Johnnie O_
Kilo Guru

To add to the comments/work_notes you want something like this:

gr.comments.setJournalEntry(current.variables.comments);

Raghu Loganatha
Kilo Guru

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.