Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to hide attachment icon of catalog item in service portal

sumitjumale
Kilo Contributor

I want to hide attachment icon for specific catalog item in "Service Portal" view.

Note: I am able to hide on normal catalog item view but not in "Service Portal" The code which i have written is working on catalog item view but its not

working on "Service Portal" view even i have used "UI Type = Bothe" in client script.

find_real_file.png

Please suggest.

Regards,

Sumit

21 REPLIES 21

John Shores1
ServiceNow Employee
ServiceNow Employee

I'm trying to solve for the same issue. I haven't tried it yet, but I'm thinking about cloning the widget, adding an item to the options schema, and then using ng-if to evaluate whether the option is true or not.  In the body of the widget HTML, I think I can do something like this to hide the add attachments link based on the option: 

<div class="wrapper-md row no-margin" ng-if="c.options.show_add_attachments === 'true'">
          <now-attachments-list template="sp_attachment_single_line" ></now-attachments-list>
          <label ng-if="!submitting" style="float:right;font-weight:normal;cursor:pointer;">
            <sp-attachment-button></sp-attachment-button>
            <span style="padding-left:4px;">${Add attachments}</span>
          </label>
</div>

I'll let you know how it goes.

Mark Roethof
Tera Patron
Tera Patron

Hi There,

In Madrid there's a checkbox "Hide attachment" [no_attachment_v2].

Untill then, you can use some manipulation (not recommended, though does work on Service Portal):

Create a new Catalog Client Script
Type: onLoad

function onLoad() {
	
	var attachmentButton = top.document.getElementsByTagName('sp-attachment-button');
	attachmentButton[0].parentNode.hidden = true;
	
}

Kind regards,
Mark

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Well, we're on Madrid and "Hide attachment" [no_attachment_v2] simply isn't working:

Catalog Item "Hide Attachment" no_attachment_v2 not working

Are you also using the new widget or an old one or and old cloned one which won't get any updates from patches/upgrades? Just being on Madrid is not enough.

Kind regards,
Mark

---

LinkedIn

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

LinkedIn

Yep, we have a cloned catalog item widget... that's the culprit.

Thanks!