- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2019 10:40 PM
Hello.
When I closed a ticket, I would like to hide the attachment icon.
I referred to https://community.servicenow.com/community id=community_question&sys_id=14fa8dc0db8b5b0423f4a345ca96... and created client script as below.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
var checkValue = g_form.getDisplayBox('state').value;
if (checkValue == "Closed"){
g_form.disableAttachments();
} else {
g_form.enableAttachments();
}
}
However, It doesn't work.
I would appreciate it if you could answer.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2019 10:57 PM
Hi
Sorry for the script above, please try with this -
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
//var checkValue = g_form.getValue('state').value;
if (newValue == 7)//check for Closed state backend value{
g_form.disableAttachments();
} else {
g_form.enableAttachments();
}
}
Regards
Omkar Mone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2019 04:05 PM
It works! Thank you for your help.
I think maybe because of cache.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-17-2019 11:31 PM
Hi,
If the record is not allowed to have write operation once it is closed then out of the box that icon should be hidden
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2019 03:30 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-18-2019 05:35 AM
Hi S.S,
Please make change to your onChange Client Script as below:
Below Script is test and works fine on my instance.
Remove below line from onChange client Script :
if (isLoading && newValue==='')
{
return;
}
function onChange(control, oldValue, newValue, isLoading, isTemplate)
{
if(newValue == '3')
{
g_form.disableAttachments();
} else
{
g_form.enableAttachments();
}
}
Regards,
Sanket
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2022 05:22 AM
Can anyone provide me the script for this on Qubec Version please?