Add additional comments via script on requested items by disabling notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2022 02:18 AM
I want to add additional comment on requested items in bulk by disabling comments.
I am trying using scheduled job as below script but additional comments are not coming
var sc_req_item = new GlideRecord('sc_req_item');
sc_task_gr.addEncodedQuery("request.requested_for=javascript:gs.getUserID()^active=true^number=RITM0123312");// number of RITM on which comment shoulf go i.e. query
sc_req_item_gr.query();
while (sc_req_item_gr.next()) {
gs.log('Auto-reassign Scheduler : auto-reassigning the task record as part of request number- for '+sc_req_item_gr.getValue('req number'));
sc_req_item_gr.setValue('Additional comments','This ticket was closed unintentionally as part of a clean-up activity. As part of the correction the ticket has been re-opened at the same state, we apologize in advance for any inconvenience caused');//additional comment on RITMs
sc_req_item_gr.update();
}
Please guide how I can achieve this
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2022 11:40 PM
I used this script and is working fine if I run query for single record.
But when I run query as system administrator for bulk record it is showing run by requested by user name for some records and I am running this script today on 9-4-2022 and the additional comment date is showing of 30-3-2022. The date at which ticket was open. Don't know why is this happening. Will you please help with the same.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-11-2022 07:05 AM
On step 7 of the script I see there is a Log statement calling sc_req_item_gr, can you comment out this line or replace 'sc_req_item_gr' with 'requested_item' and try again?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2022 06:55 AM
Hi,
Can you Set Journal entry like below and see
requested_item.comments.setJournalEntry("Content of the journal entry.");
Please hit helpful if this works:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-08-2022 11:44 PM
This is triggering notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-10-2022 10:04 PM
Please use setworkflow(false) before update and try.