Force adding comment when attaching a file

imrane
Kilo Expert

Hi everyone,

I used "Ticket Conversation" widget in the Ticket Form on Service Portal

It is all OOTB

When a user add an attachment to an Incident, no notification on ITIL user are triggered, nor Business Rule

Indeed, there is no filter condition of type : "Additionnal Attachement : changes" as the existing "Additionnal Comments : changes"

To find a workaround, I want to force user to add a comment to allow them to add an Attachement

So that, adding an Attachement will triggers Notifcation and Business Rule because of "Additionnal Comments : changes"

Do you have any idea how can I manage to do this ?

Thanks

1 ACCEPTED SOLUTION

antin_s
ServiceNow Employee
ServiceNow Employee

Hi Imrane,



Do you want to try creating a Business Rule on the sys_attachment table with the condition for table name?



Asking for a comment for attachment doesn't look like a good user experience and also user might end up entering some random text.



Hope this helps. Mark the answer as correct/helpful based on impact.



Thanks


Antin


View solution in original post

5 REPLIES 5

Thanks. It works.



Here is my Business Rule and the advanced script :


find_real_file.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);