How to hide "Add attachments" button in a particular catalog item in Service Portal

AW1
Tera Contributor

Need hide "Add attachments" button for a particular item, not on all widgets, in Service Portal. How can it be done?

1 ACCEPTED SOLUTION

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Since Madrid, there's out-of-the-box functionality for this: a checkbox on the Catalog Item to hide the attachment.
See this article for detailed explanation.
Service Portal Catalog Items: Hide Attachment / Mandatory Attachment [Madrid]

Madrid checkboxes

image

Be aware:
For some this doesn't work. Why? Because they cloned the SC Catalog Item widget or are using an older widget. If you cloned the widget, the improvements made by ServiceNow are obviously not in your cloned versin.

If my answer helped you in any way, please then mark it as helpful.

Kind regards,
Mark
2020 ServiceNow Community MVP
2020 ServiceNow Developer MVP

---

LinkedIn
Community article list

 

Kind regards,

 

Mark Roethof

Independent ServiceNow Consultant

10x ServiceNow MVP

---

 

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

LinkedIn

View solution in original post

12 REPLIES 12

Mike Patel
Tera Sage

Clone SC Catalog Item and add to the page.

On clone widget in client script you will see something like. Make sure to add sys_id of catalog item you want to exclude 

c.showAttachments = function() {
		return !$scope.submitted &&
			!c.data.sc_cat_item.no_attachments &&
			c.data.sc_cat_item.sys_class_name !== "std_change_record_producer";
	};

change it to

c.showAttachments = function() {
        if (c.data.sc_cat_item.sys_id == 'SYS id of catalog item') {
            return false;
        } else {
            return !$scope.submitted &&
                !c.data.sc_cat_item.no_attachments &&
                c.data.sc_cat_item.sys_class_name !== "std_change_record_producer";
        }

 

I found this helpful. This code was missing from my cloned SC Catalog Item from 2020. I found adding this code into my cloned version added the functionality of "Hide Attachment" on Service Portal to work OOB.

Cuong Phan
Kilo Sage

Hi Amy,

 

There is a field named "Hide attachment" on catalog items lists, ticked and will hide the button.

find_real_file.png

Regards,
Cuong Phan
ServiceNow Technical Lead