How to make OOB attachment mandatory for one request type in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hi Community,
I am working on a Service Catalog / form in ServiceNow.
Requirement:
Make the OOB attachment (paperclip at bottom) mandatory only for one request type, without showing any alert message.
Current setup:
Catalog Item / Incident form
Tried UI Policy and onChange Client Script
Issue:
The attachment does not become mandatory. I couldn’t find any backend field name for OOB attachment.Question:
Is there any supported OOB way to make the attachment mandatory conditionally, or is scripting the only option?Thanks in advance.
#attachments #clientscripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Hi,
The paperclip attachment is not a normal field/variable, so UI Policies and “mandatory” logic wont work on it the same way they do for catalog variables. Thats why you can’t find a backend field name for it.
There isnt a supported OOTB switch to say “make attachments mandatory only when request type = X.” The usual (and accepted) way to do this is to enforce it with scripting.
For a catalog item, I would say the clean approach is an onSubmit Catalog Client Script:
Check your “request type” value
Check whether any attachments exist
If none, stop submission
You can do this without using an alert(). Most folks show a small inline message instead, but if you truly want no message at all, you can just block the submit it’ll just feel like the button didnt work.
So bottom line:
No OOTB conditional “mandatory attachment” option for the paperclip
Scripting is the standard solution (client-side for catalog items, and server-side if you need stricter enforcement)
I hope this helps you my friend 🙂
@JyotiranjanC - Please mark as Accepted Solution and Thumbs Up if you found Helpful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Tuesday
Apologies if I've interpreted this wrong...
When creating a new catalog item, under portal settings, there is an option for 'Mandatory Attachment'
