Hide Attachment not working on Content items on Service portal : Madrid

Snigdha A
Giga Contributor

I created a 'Service catalog content item' to display some static text, to be available on both CMS and Portal views.we are on Madrid version. I want to hide 'Add Attachments' on portal view for this item and made checkbox 'Hide Attachment (no_attachment_v2=true)' but still 'Add Attachments' is getting displayed on portal view.

Please help me how to solve this.

Note : Hide Attachment is working fine for Service catalog items but not for Content items

1 ACCEPTED SOLUTION

Snigdha A
Giga Contributor

This is the known issue with content items on portal in Madrid release. It is fixed in Newyork release.

View solution in original post

12 REPLIES 12

Chavan AP
Tera Guru

Hi Snigdha,

 

 

Please refer below article by Mark, i am very sure this will help you

 

 

Pre-Madrid, we could script this thru Catalog Client Scripts. Another option would be to customize the SC Catalog Item widget. Both not great, the Catalog Client Scripts are needed on every Catalog Item you wish to have this functionality on, customizing the SC Catalog Item would mean you would miss updates from patches/upgrades.

For if you are not yet on Madrid and do want to hide attachments or make attachments mandatory. Here is some example scripting.

Hide attachment - onLoad Catalog Client Script

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

Mandatory attachment - onSubmit Catalog Client Script

function onSubmit() {
  
	if(this.document.getElementsByClassName('get-attachment').length == 0) {
		g_form.addErrorMessage(getMessage('mandatory_attachment'));

		return false;
	}	
   
}

With Madrid, some cool and super easy checkboxes are introduced! Checkboxes which can be configured for Catalog Items individually and making scripts like above obsolete.

Madrid checkboxes

image

And that's actually it! So easy to apply.

 

Do mark it correct answer and helpful in response if this resolves your query

 

Regards,

Ajay

Glad I could help! If this solved your issue, please mark it as ✅ Helpful and ✅ Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

Snigdha A
Giga Contributor

Hi Ajay,

Thanks for referring to this article, but i already checked this article. 

As mentioned in question earlier, i made "Hide Attachement" to true but still 'Add attachment' is displayed on Content items in portal. This is working for Service catalog items but not on Content items.

I tries to modify portal widget also but no luck. I f some one has ideas on how to modify portal widget to correct this please help.

Hi there,

Have you checked that you are using the out-of-the-box "SC Catalog Item" widget?

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

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

Just tested with Content Item like below:

find_real_file.png

On Service Portal (with SC Catalog Item widget), is shown without Attachment:

find_real_file.png

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

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