Update RITM "Comments" and Work note fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2017 10:49 AM
I am trying to update both "Comments" and "Work Note" my Requested Item when approver reject, I used the following script in Run Script of my workflow:
var note ="This Retirement RITM is being rejected as the related change request was not approved" ;
var item = new GlideRecord('sc_req_item');
item.get(current.sys_id);
item.comments =note;
item.work_notes = note;
item.update();
However, both fields are not updated. Event I did run the following script in Back-ground script, but it still not works.
var note ="This Retirement RITM is being rejected as the related change request was not approved" ;
var item = new GlideRecord('sc_req_item');
item.get('896ae660dbe5c7007e94ff621f961985');
//gs.print(item.comments);
item.comments =note;
item.work_notes = note;
item.update();
gs.print(item.comments);
gs.print(item.work_notes);
Can anyone help?
- Labels:
-
Team Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2017 11:07 AM
You either need to write a business rule on sysapproval_approver table or write a query in your run script to query the sysapproval_approver table to get the comments.
I would suggest adding a business rule on sysapproval_approver table.
Please mark this response as correct or helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2017 11:08 AM
Refer below link
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2017 11:09 AM
Hi Nancy,
I tried your script on my instance it does work.. except for the print part.
var note ="pushed note2" ;
var item = new GlideRecord('sc_req_item');
item.addQuery('sys_id','aeed229047801200e0ef563dbb9a71c2');
item.query();
item.next();
//gs.print(item.description);
item.work_notes=note;
item.comments=note;
item.update();
gs.print(item.work_notes.getJournalEntry(-1)+'');
gs.print(item.comments.getJournalEntry(-1)+'');
I found some pointers here Attach work notes from task to RITM?
Hope it helps.
Regards
Ravindran

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2017 11:09 AM
Hi Nancy,
Since those are journal fields try using setJournalEntry('value to be passed').