How to avoid invalid reference if any junk value is given in catalog reference field (non-mandatory)

skmohiuddin
Tera Contributor

Hi,

I have a reference field which is not mandatory on the service catalog. If i give any junk value it accepts and allows submission.

Is there any way to restrict this through onChange or onSubmit?

3 REPLIES 3

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

Reference fields by default will only accept valid values.   What will happen is that the invalid value doesn't match then that field isn't filled in upon insert/update.   Now if that reference field was mandatory then it will not accept junk and you will get a message saying that field is mandatory.



Now this said there is an attribute you can add to the dictionary record of the reference field to automatically add new values to the referenced table.   I mention this in case yours is setup this way.


Hi Michael,



The reference field table name is change_request. If we add some value junk value like "aaaa bbbb ccc" then it doesn't make sense to add these new values to the referenced table. I am looking for some kind of validation at client or server side to avoid such submission.



Thanks,


Mohiuddin


OK by default if you enter junk the junk value is NOT added to the reference table - you have to set that up.   But if you enter junk and click submit/order or whatever it won't set that referenced field with a junk value.   So there isn't a need for a client or server validation since its not accepted.