How do I make the attachment field mandatory in Service Portal or Employee Center?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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
- 718 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
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
3 weeks ago
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
3 weeks ago
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

