Add additional comments via script on requested items by disabling notifications

Ankita Gupte
Kilo Sage

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

23 REPLIES 23

It will not post the additional comment as well.

Ok.. in that case, Prevent notification to run on update of comments , 

write script in advanced script section for this - 

eg: if(  current.comments.changes )

//prevent

hamzanutrax
Kilo Contributor

Nutraxin offers high-quality vitamins, minerals & supplements for the brain, bone, joints, skin, hair, nails & more in Pakistan. Stay fit and active all day!

Multivitamins

@Dan Bruhn  Need support here.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************