Restrict User to submit form if User Attach CSV file and contain Invalid email domain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
hi,
I want to achieve a task in which restrict the users to submit the catalogue item if user attach a csv file and contains invalid email domain in it. Also alert user to highlight the row number in which error occur.
There is only one column in the file.
can somebody help on it.
thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @yadi ,
To solve this, you need to add a validation step before the catalog item is submitted. The idea is that when the user clicks Submit, an onSubmit Catalog Client Script should run to check the attached CSV file. This script will call a Script Include through GlideAjax, because attachments can only be read on the server side. The Script Include will read the uploaded CSV file, go through each row (since it has only one column with emails), and check the domain part of every email address. If it finds an invalid domain, it will record the row numbers where errors occur and send them back to the client script. The client script will then alert the user
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
hi Tejas,
thanks for the response, that whole process i know but can you please help me with the script i can alter based on my requirement.
again thanks for the help
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
it will be heavy customization as you will require onSubmit catalog client script and then parse the CSV and read each row and stop form submission.
you can try to use Attachment variable on form and then use onChange catalog client script and do the validation.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
hi ankur,
thanks for the response, can you please help me with the script if possible.
regards
Yadi