- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2026 10:56 AM
Hello, I just wanted to contribute by sharing how to make an attachment mandatory in ServiceNow when, for some reason, you can’t use the default “Mandatory attachment” button on the catalog item. I found a very simple way to do it and wanted to share it since there isn’t a place in the Community that gets straight to the point.
1. Create a Catalog Client Script
2. Required things to fill in:
Type: OnSubmit
(We do it in OnSubmit because this will prevent the user from submitting the form until they attach something.)
Only select Applies on a Catalog Item view. If you select Applies on Requested Item and Catalog Task, it will cause an error, especially if the user removes the attachment.
In the script, copy this:
-----------------------------------------------------------------------------------------------------------------------------------------------
g_form.addErrorMessage('please attach something');
This part of the code will show a default ServiceNow alert, informing the user that they cannot submit anything until an attachment is added:
And that’s it — it’s that simple.
Greetings from Colombia
Solved! Go to Solution.
- 2,192 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2026 07:45 PM
why you can't use "Mandatory Attachment" checkbox for portal?
Your requirement can be achieved without scripting
Simply enable that checkbox
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2026 08:06 PM
Hi @anamariatam,
There is a mandatory attachment checkbox option in portal settings; you can select that.
If you find my answer useful, please mark it as Helpful and Correct 😊
Regards,
Soham Tipnis
ServiceNow Developer || Technical Consultant
LinkedIn: www.linkedin.com/in/sohamtipnis10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2026 07:30 PM
Hi,
If it is a Catalog item
- go to the maintain item --> Catalog item
- Create a UI policy
- Make the variable field mandatory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2026 07:45 PM
why you can't use "Mandatory Attachment" checkbox for portal?
Your requirement can be achieved without scripting
Simply enable that checkbox
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2026 08:06 PM
Hi @anamariatam,
There is a mandatory attachment checkbox option in portal settings; you can select that.
If you find my answer useful, please mark it as Helpful and Correct 😊
Regards,
Soham Tipnis
ServiceNow Developer || Technical Consultant
LinkedIn: www.linkedin.com/in/sohamtipnis10
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
5 hours ago
I have no idea why two replies saying "just use Mandatory Attachment" are marked as accepted solutions when the poster specifically says they're addressing situations where that approach won't work.
In my case, I have a Catalog Item where attachments should only be mandatory under certain conditions, so the Mandatory Attachment checkbox doesn't do me any good. I could use attachment variables, but since there's not a specific number of required attachments, and since attachment variables can't be used in an MRVS, I would have to make some fixed number of variables and hope for the best. @anamariatam, thanks for providing such a good alternative.
