Populating Additional Comments field with Record producer variable values

kushal2
Kilo Contributor

Hi Guys,

I am trying to set 'additional comments' journal field of change form with some answers given by end users for record producers. I can able to set same for existing record but when a new record is being created at the same time i want to set additional comments field. In my script I am getting current.sys_id as blank , so basically my question is how to return sys_id of newly created change request to record producer script?

Working code for existing record in record producer script

var gr1 = new GlideRecord('change_request');
gr1.addQuery('sys_id','adeec8501bc710109bda7596cc4bcbe8');
gr1.query();
if(gr1.next())
{
  gr1.comments.setJournalEntry('test');
  gr1.update();
}
 
Not Working code 
var gr1 = new GlideRecord('change_request');
gr1.addQuery('sys_id',current.sys_id);
gr1.query();
if(gr1.next())
{
  gr1.comments.setJournalEntry('test');
  gr1.update();
}
 
 

 

1 ACCEPTED SOLUTION

You do not need the current.update()

The assignment group is set? (so it gets to the part in the 'if (gr.assignment_group)')

Can you try removing current.update().

 

 

You are setting it in the 'Script', right?

find_real_file.png

View solution in original post

6 REPLIES 6

You do not need the current.update()

The assignment group is set? (so it gets to the part in the 'if (gr.assignment_group)')

Can you try removing current.update().

 

 

You are setting it in the 'Script', right?

find_real_file.png

kushal2
Kilo Contributor

Bang on Willem:)

It worked out by removing current.update();

I got the logic too.

Many Thanks