- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2015 11:10 PM
I want to validate a field for duplicate entry before saving the record.
So I would like a client script to validate the value and if the value is not valid I will display a field message (got that part) but then I want to prevent a save/submit to be performed. How can I do that?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2015 11:27 PM
Hi Tommy,
If you're trying to do this validation from an onSubmit client script, I believe you can then return false within your script when the value is not valid and the submission will be stopped.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2015 11:27 PM
Hi Tommy ,
can you please some more information like, on which table you are working(if your field , on which table..)
we have OOB unique index on some fields which does not duplicate value on that field Unique Index - ServiceNow Wiki .
you need to write a script , which will query database to check whether that value is already present or not, if present then abort the insert action.
Thanks & Regards
Govind Kumar Sharma
PS: Hit like, Helpful or Correct depending on the impact of the response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2015 11:31 PM
Unique key index will not work for me because in some cases I will allow duplicate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2015 11:27 PM
Hi Tommy,
If you're trying to do this validation from an onSubmit client script, I believe you can then return false within your script when the value is not valid and the submission will be stopped.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2015 11:35 PM
Thanks.