- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2019 07:25 AM
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.
UI script written to hide that icon.
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
Regards,
Chaithra
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-15-2019 07:26 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2019 07:33 AM
Hi there,
Not sure if you have the table available, like your doing with g_form.getTableName(). Though, in the URL, sysparm_table is available! Would this help?
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Mark
---
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2019 09:27 AM
Thanks Mark for your insights. Yes, sysparm_table which is available in the url helped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2019 07:46 AM
Hi Chaithra,
In the url you have sysparm_tabl; use that and hide it if incident or sc_task table
var name = 'sysparm_table';
var tableName = '';
var url = document.URL.parseQuery();
if(url[name]){
tableName = decodeURI(url[name]);
}
if(tableName == 'sc_req_item' || tableName == 'sc_task'){
// code to hide that
}
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
‎05-13-2019 09:21 AM
Hi Ankur,
This worked!! Thanks a lot for your help and insights 🙂
Pasting the code below, so it could be useful for anyone who is looking for it
//Updated by Chaithra on May 13th, 2019 to make this attachment clip icon visible only in the Incident form
var name = 'sysparm_table';
var tableName = '';
var url = document.URL.parseQuery();
if(url[name]){
tableName = decodeURI(url[name]);
}
// Code to hide the attachment icon in ritm and task forms
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);
}
});
}
Regards,
Chaithra