Show/Hide attachment icon in the Incident form - in the email template

Chaithra Srini1
Mega Expert

Hi everyone,

We have one UI script which hides the 'attachment' icon in the email template of Incident form. The attachment icon and UI script written to hide it are shown below.

Is there any way to hide that attachment icon from RITM and sc_task table and keep it visible in only 'incident' table. Please help me with your insights. Thanks in advance.

- Navigate and open any incident form > Click on 'More Options' (3 dots)
- Click on 'Email template' icon
- In the template form, you will see the 'attachment' icon. 

find_real_file.png

UI script written to hide that icon.

find_real_file.png

Is there any way that we can hide it only for Incident form/table? Please advise.

FYI, I am trying below code to incorporate the requirement, but it is not working

find_real_file.png

Regards,
Chaithra

1 ACCEPTED SOLUTION

Hi Chaithra,

So you have reverted it to previous version and have not kept the code to get sysparm_table?

Are you running this in scoped app?

try this once instead of above code given by me

var gURL = new GlideURL();
gURL.setFromCurrent();
var tableName = gURL.getParam("sysparm_table");

if(tableName == 'sc_req_item' || tableName == 'sc_task'){

addLoadEvent(function() {
if (window.g_user == undefined) {
return;
}
try{
if(document.URL.indexOf('email_client.do') >= 0) {
$j(document).ready(function(){
$j('#attach_button').hide();
});
}
}
catch(e){
alert(e);
}
});

}

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

14 REPLIES 14

Hi Chaithra,

Glad that it worked. Can you also mark my answer as correct and helpful.

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Chaithra Srini1
Mega Expert

Hi Ankur,

After implementing the above code, whatever we type in the navigation bar and click on any module.

For example, If we type 'Incident' and click on 'Incidents' or 'Create New', it is opening in a new window and this is happening everytime. Please advise whether it is related to tableName or anything?

Thanks,

Chaithra

Hi Chaithra,

I don't think it has anything to do with the above script. since that script will only run for email client.

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Chaithra Srini1
Mega Expert

Hi Ankur,

Okay, but reverting this script back to previous version fixed the above issue. Sp, I was just thinking is it something related to URL or decodeURI?

Regards,

Chaithra

Hi Chaithra,

But was it working for other tables after adding code for sc_req_item and sc_task?

Regards

Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader