Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

To restrict attachment on incident from, once state is closed or resolved.

pratik_kumar
Giga Expert

Hi All,

I want to restrict users from attaching files on incident form, once incident is closed or resolved.

Kindly provide your input on this.

5 REPLIES 5

Ujjawal Vishnoi
Mega Sage

Hi Pratik,



You can use Onload client script with below mentioned code.



var status = g_form.getValue('state');


  if(status=='6'||status=='7') // state 6 for resolved and 7 is for closed


  {


  $('header_attachment_list_label').style.display = 'none'; //This line will disable the option to add new attachment if some attachment already attached with incident


  g_form.disableAttachments();   //This line will disable the attachment from .


  }



Hope this helps.



Regards,


Ujjawal