Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Add field message when field is unlocked only

erck
Tera Contributor

I'd like to display a field message only when the field is unlocked. 
And have the message go away when the field is locked again. 

 

Is there a way to do this ? I was trying to use 

document.getElementById('incident.u_environment_unlock')

somehow , but the id for the field is different when its locked and when its unlocked. 

 

Any ideas ? 

3 REPLIES 3

erck
Tera Contributor

Screenshot 2024-04-05 at 3.15.32 PM.pngScreenshot 2024-04-05 at 3.15.25 PM.png

IbrahimK4837164
Tera Contributor

You can use a field's state change event to show or hide a message depending on whether the field is unlocked or locked. For example, you can add an event handler for a field that will display a message if the field is unlocked and hide it if the field is locked.