How to make attachment mandatory in a record producer creating an incident?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 03:05 AM
I have a record producer form creating an incident . It is accessed from the service portal. Attachment has to be made mandatory before submission of the form. Can anyone please suggest the best way to achieve it in Service portal? Thanks in advance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2019 03:07 AM
Hi there,
You could add an onSubmit Catalog Client Script like below:
function onSubmit() {
if(this.document.getElementsByClassName('get-attachment').length == 0) {
g_form.addErrorMessage(getMessage('Attachment is mandatory!'));
return false;
}
}
Be sure to double check the UI Type in the Catalog Client Script!
Kind regards,
Mark
Kind regards,
Mark Roethof
Independent ServiceNow Consultant
10x ServiceNow MVP
---
~444 Articles, Blogs, Videos, Podcasts, Share projects - Experiences from the field

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2019 09:47 PM
The above client script is working fine in London version
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2022 09:56 AM
Thanks very much. This worked for me.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2025 06:09 AM
not working in Xanadu release