Need to add an Alert to a Reference Field when it shows the error "Invalid Reference"

ksmithdev
Mega Expert

Hi there,

 

I have a reference field that will be looking to make sure a number matches what is in the database. The thing I need to add, is that when the field can't match the input to the database/can't find the record, OOB service-now puts the red dotted line and a hover over message saying "Invalid Reference". When this happens, I need to figure out a way to put a g_form alert message to the field to say that the "Number is Invalid". I am guessing this has to be a client script.

 

I have looked all over the wiki, and what I did find (an observe.click function ordeal) did not work. Anyone else have a better idea?

7 REPLIES 7

Hey Brad! I actually took a Sys admin course with you in NYC last year.



Thanks, I will give this a go.


Snehlata2
Kilo Contributor

How to apply the same for a reference field in an order guide?


Just make the field mandatory if not already and you wouldn't actually need a alert.