How to block catalog submission if portal attachment CSV is invalid?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi all,
I’m working on a catalog item (Service Portal) that requires users to upload a .csv file using the default portal attachment.
I need to:
Prevent submission if the attached file is not a .csv or is missing required headers (like batch_ref, origin, etc.)
Show a user-friendly error message explaining what’s wrong
Ideally block the entire request (REQ + RITM) if the file is invalid
I’ve tried:
onSubmit client script - can’t access the attachment before submit
GlideAjax - same issue, no attachment available yet
Business Rule on sc_req_item - works for validation, but REQ still gets created. This leads to a less-than-ideal user experience, since users have to go back and resubmit the catalog item from scratch.
Is there a supported way to fully block submission with the portal attachment field? Or is a custom widget or attachment variable the only real option? - I ask because the uploaded file will eventually be sent to an AWS S3 bucket via IntegrationHub, so it would be ideal if the file ends up in sys_attachment (like the default portal attachment does), rather than inside a variable, to simplify downstream automation.
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I will suggest to use attachment variable and add the variable attributes to only allow CSV file
allowed_extensions=csv
Now you can write onChange catalog client script to validate the file header etc
check this link where I shared solution for something similar, you can enhance it to check columns
Not Allow Special Characters in the attachment type variable in the Service Catalog
see if this link helps and enhance your script, I shared solution on how to validate file when file is attached to attachment variable
Validate Excel Data and populate in MRVS
💡 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @Ankur,
Thanks so much for the suggestion. I agree that attachment variables offer really nice client-side validation options. That said, I’m a bit torn. In our case, the next step is to send the uploaded file to an AWS S3 bucket via IntegrationHub, for that to work smoothly in Flow Designer, don't we need the file to live directly in sys_attachment on the RITM?
My understanding is that using the default portal attachment simplifies this quite a bit and it avoids the need to extract the file from a variable or do any additional resolution logic in the flow.
So while we’re currently using a Business Rule for server-side validation (and accepting that tradeoff), I’m wondering: is there truly no way to get similar client-side validation while still using the portal attachment field? Or perhaps some supported pattern that doesn’t involve a full custom widget?
Appreciate any thoughts or experiences you (or others) might have around this!
Reagards,
Leo
