Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to add the Additional comments on the requested form

Nikita Gupta1
Tera Contributor

I want to set the additional comments through schedule job.I am able to display the data on the journal table not on requested form.

1 ACCEPTED SOLUTION

That's not a proper way to write additional comments.
You will need to write it by setting the value on the task-record instead.

Something like this:

var incGR = new GlideRecord('incident');
incGR.setLimit(1);
incGR.query();

while (incGR.next()) {
  incGR.comments = 'New additional comment here';
  incGR.update();
  gs.info('Updated incident: ' + incGR.getValue('number'));
}

View solution in original post

6 REPLIES 6

RaghavSh
Mega Patron

Can you share the code snippet?


Raghav
MVP 2023
LinkedIn

  var grJrnl = new GlideRecord('sys_journal_field');
       grJrnl.initialize();
             grJrnl.setValue('name', 'sc_req_item');
             grJrnl.setValue('value', 'This requested item is no longer availabe');
             grJrnl.setValue('element', 'comments');
             grJrnl.setValue('element_id', gr.sys_id);
             grJrnl.update();

 

I have written this code ..I am able to display the data on journal table but not on requested form

That's not a proper way to write additional comments.
You will need to write it by setting the value on the task-record instead.

Something like this:

var incGR = new GlideRecord('incident');
incGR.setLimit(1);
incGR.query();

while (incGR.next()) {
  incGR.comments = 'New additional comment here';
  incGR.update();
  gs.info('Updated incident: ' + incGR.getValue('number'));
}

Thankyou, it is working perfectly