How to disable attachment icon in form header on a particular view?

Kotha Sowmya
Tera Contributor

Hello,

We have a requirement to disable attachment in form header on a particular view.

Users can view the attachment if any exists on the form but they cannot add or remove or edit attachment.

We have gone through the below links where we can hide it on the table level-

Disabling and Enabling Attachments for all user to a specific table in a ServiceNow Instance - Suppo...

https://community.servicenow.com/community?id=community_question&sys_id=fc1157e9dbdcdbc01dcaf3231f961923.

Can anyone suggest for the above requirement if you have any ideas?

 

Thanks,

Sowmya

1 ACCEPTED SOLUTION

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Here is the working code. Make sure you replace view name in place of ess ok.

function onLoad() {  
    //Type appropriate comment here, and begin script below  
    var view = getView();  
  if (view == 'ess'){   //self service view name is ess so make to ess
 g_form.disableAttachments();
  }  
}  

Please hit like and mark my response as correct if that helps

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

View solution in original post

2 REPLIES 2

Musab Rasheed
Tera Sage
Tera Sage

Hello,

Here is the working code. Make sure you replace view name in place of ess ok.

function onLoad() {  
    //Type appropriate comment here, and begin script below  
    var view = getView();  
  if (view == 'ess'){   //self service view name is ess so make to ess
 g_form.disableAttachments();
  }  
}  

Please hit like and mark my response as correct if that helps

Regards

Please hit like and mark my response as correct if that helps
Regards,
Musab

Thank you...I got instead of getting view name ,I have deselected global and provided view name on onload client script..it worked.