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

Jotiram Yadav
Tera Expert

Hello Pratik,



Though it is not preferred to use DOM manipulation, you can try something like this in onload client script.


document.getElementById('header_add_attachment').style.display='none';



Check in the script if incident is closed or resolved.



Hope this helps.



Thanks,


Jotiram


anjalichoudhary
Kilo Guru

Hi Pratik,



You can create the client script to hide or disable the attachment option when incident state is closed is resolved as per your requirement. Below is the script for the same to hide when state is closed:



function onLoad() {


    if (g_form.getValue('incident_state') == '7')


          g_form.disableAttachments();


}



Regards,


Anjali


Hi



Thanks for your response.



I don't want to hide attachment icon.



Is there any other option, so we alert error message as "Incident is close, so you can;t add attachment"


Alikutty A
Tera Sage

Hi Pratik,



You can write an onload client script to validate the state and add this code



if(g_form.getValue('state') == 3 || g_form.getValue('state') == 6){


  g_form.disableAttachments();


}



3 - Closed


6 - Resolved



Thanks


Please Hit like, Helpful or Correct depending on the impact of the response