Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Clear Record Reference Field if other fields change?

MBarrott
Mega Sage

Want to see if there is a viable solution for this:

 

Essentially I have an onboarding access form where the user (if pre-existing) can enter their name. This pulls then auto-populates multiple other fields for the form (names, email, phone etc)

 

These fields can be modified but what I would like is for the record reference field to clear out if anyone modifies any of the auto-populated fields.

 

Example: Someone enters John Smith in the record reference field and pulls all of John's data. John then makes manual corrections to the form data - in this scenario I would want the record reference field to reset, ensuring other fields also clear out. 

 

Is this easily achievable?

3 REPLIES 3

AshishKM
Kilo Patron

Hi @MBarrott , 

Yes, did you try with onChange client script.

Please share the screen shot of form and refere which field is changing and which one need to clear out.

 

-Thanks,

AshishKM

 

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution

Hi @AshishKM, 

 

An onChange script was my first thought but given that there would be so many fields that could be changed, it felt like it would be cumbersome having so many doing a nearly identical check.  

 

See example below - so if First Name, Last Name, Department or Location change, then the Employee Name would clear. Was hoping there'd be a way without 4 unique onChange scripts. 

MBarrott_0-1741296693777.png

 

Thanks for sharing.

I can see that, both First Name and Last Name fields are not reference type , how the Employee Name is getting the data .. have you written some code.

 

and how the department & location change related with Employee Name.

Yes, there are 4 possibility of changes, then need 4 onChange script.

 


Please mark this response as correct and helpful if it helps you can mark more that one reply as accepted solution