Skip to content

Conversation

chetnadev
Copy link
Contributor

This ServiceNow client script is designed to validate file attachments on a form before submission. It's most likely used as a "Client Script" or "Client Script in a Catalog Item" that runs in the browser when a user tries to submit a form.

This client script runs when a form is submitted in ServiceNow. It checks if the user has:

Attached at least one file (shows an error if none).
Attached no more than three files (shows an error if more).
Only uploaded files of type PDF or PNG (shows an error for other types).
If any of these checks fail, the form submission is blocked and an appropriate error message is displayed.

@Atul-LNG Atul-LNG self-assigned this Oct 9, 2025
Copy link
Contributor

@Atul-LNG Atul-LNG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. For next time, you might consider using system properties to specify the attachment type.

@Atul-LNG Atul-LNG merged commit 7661a0a into ServiceNowDevProgram:main Oct 9, 2025
1 check passed
@Atul-LNG
Copy link
Contributor

Atul-LNG commented Oct 9, 2025

Thanks @chetnadev for your contribution and participation! Keep contributing, and encourage your colleagues to participate as well!"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants