Post Work notes on RITM using script

Rajanmehta
Mega Guru

Hello,

I am trying to add some work notes on an existing RITM using script (below). I am able to see the record on sys_journal_filed table but doesn't show up on RITM. What am  I missing? Please advise.

Thanks,

Rajan 

 

var grJrnl = new GlideRecord('sys_journal_field');
grJrnl.setValue('name','sc_req_item');
grJrnl.setValue('value','Testing....Again');
grJrnl.setValue('element','work_notes');
grJrnl.setValue('element_id','sys_id of RITM');
grJrnl.insert();

 

 

 

 

 

1 ACCEPTED SOLUTION

Allen Andreas
Tera Patron

Hello,

I'm unsure where this script is at (like business rule or what) or why you're gliding to journal_field table...but you can simply do:

variable.work_notes = "Text here";

or whatever variable holds your record and do work_notes after it.

Please mark reply as Helpful/Correct, if applicable. Thanks!

View solution in original post

5 REPLIES 5

Allen Andreas
Tera Patron

Hello,

I'm unsure where this script is at (like business rule or what) or why you're gliding to journal_field table...but you can simply do:

variable.work_notes = "Text here";

or whatever variable holds your record and do work_notes after it.

Please mark reply as Helpful/Correct, if applicable. Thanks!

Hi Allen,

We have some RITMs which are still in open condition due to WF failed, and need to be reworked, so that's why we have to run like a script background or Fixed script. (Just one time deal)

Thanks,

Rajan 

Never mind Allen,

I got it working.

I added the work note variable value directly onto RITM as you suggested, and that worked fine.

Thanks,

Rajan 

 

var rec = new GlideRecord ('sc_req_item');

rec.addQuery('sys_id','<sys_id>);

rec.query();

if(rec.next())

rec.work_notes = "Text here";

 

Ishita Shrivast
Kilo Guru

Hi there,

I think you can simply write the client script for this.

 g_form.setValue('work_notes',"Testing");

This will simply work.

Mark it as correct/helpful, if applicable.

Regards,

Ishita Shrivastava.