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

Priyanka Chandr
Mega Guru

Hi,

Follow this steps,

1. Navigate to the catalog item in which the "Add attachments" paperclip needs to be hidden
2. Create a new variable of type 'macro' to the specific catalog item
3. Navigate to Service Portal Configuration
4. Create a new Service Portal widget with the following codes in Client controller:

function() {
/* widget controller */
var c = this;
angular.element('label.ng-scope').hide(); 

//NOTE : The above line here is a JQuery selector inside the angular.element() which is supported in service portal, feel free to change this JQuery selector if you want the attachment element selection to be more specific. In the above code the element label and the class combination are used to hide the attachment
}

5. Add the widget to the Macro type variable created in step 2


Kindly mark it correct and helpful if it is applicable.

Thanks,

Priyanka

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Did this solve your question? Or do we need to follow-up on this?

Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.

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

Mark Roethof
Tera Patron
Tera Patron

Hi there,

Did this solve your question? Or do we need to follow-up on this?

Please mark this answer as correct if it solves your question. This will help others who are looking for a similar solution. Also marking this answer as correct takes the post of the unsolved list.
Thanks.

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