Make Comments mandatory when attachment were added to ticket.

Alekhya Nagabh1
Tera Contributor

Hi All,

 

We have an requirement where , if attachment is added to the ticket we need to make comments mandatory. 

Any help would be appreciated.

 

 

Thanks!!!

1 REPLY 1

Community Alums
Not applicable

Hi @Alekhya Nagabh1 ,

You can create a Business Rule and the sample advanced script :

 

SandeepDutta_2-1702472837496.png

 

(function executeRule(current, previous /*null when async*/) {
//gs.log("IDE Atta" + current.table_name + ":" + current.table_sys_id);
var gr = new GlideRecord(current.table_name);
       gr.addQuery('sys_id', current.table_sys_id);
       gr.query();
       gr.next();

gr.sys_updated_by = current.sys_updated_by;
var msg = "Ajout de pièce jointe";
       gr.comments = msg;

gr.update();

//gs.log("IDE" + gr.sys_id + " : " + gr.sys_updated_by + " : " + gr.number);

})(current, previous);