Field messages disappearing

arobertson
Tera Guru

Hi all,

I have the following onLoad script on our change request table which works fine, but when a user then edits one of those fields the messages disappear?

function onLoad() {

g_form.showFieldMsg('description','A high level, non-technical, overview of the aims and objectives of the change.','info');

g_form.showFieldMsg('implementation_plan','A clear and detailed set of technical instructions on how you are going to get from the current state to the changed state.','info');

g_form.showFieldMsg('backout_plan','A clear and detailed set of technical instructions on how to get from the changed state to a good known state.','info');

g_form.showFieldMsg('u_communication_plan','Does the impact or result of this change need to be communicated? If so, who will send this communication and when?','info');

g_form.showFieldMsg('test_plan','What testing has been conducted prior to the change? If no pre-change testing has taken place, why not?','info');

g_form.showFieldMsg('u_post_change_testing','After the implementation of the change, what testing will be carried out and by who? What are the expected outcomes and how will you know the change has been successful?','info');

g_form.showFieldMsg('justification','Why is it needed? Business request, internal service change? Please expand on the reasons.','info');

g_form.showFieldMsg('u_business_impact','What service will be affected and how? What is the end user impact?','info');

g_form.showFieldMsg('u_clients_impacted','What is the risk to service whist performing this change? What mitigating steps to avoid impact have/will be taken?','info');

}

Would i then have to conduct an onChange check for each field and show the message again?

3 REPLIES 3

sb1186
Kilo Guru

Hi Alex,



The field message on a field only appears on a form load and disappears when the value in that field changes. It is an expected behavior.


I would not recommend creating several onChange scripts. What you can do instead is simply create the Hint definitions on the field labels so that when a user hovers over the field label, he gets the info message. It's a workaround that I would suggest.


manishm
Mega Guru

Hi Alex,



The default behavior of ServiceNow is to clear out the field messages onChange. I created a message on change and noticed that when I clear the field, the message goes away and when I select something else, it reappears. So to answer your question, yes, you would need an on Change script



You may also want to consider putting in hint instead. Configure Label->Hint would display the message every time the user hovers the mouse over the field.



Manish


kevinclark-7EL
Tera Contributor

This behaviour has (showFieldMsg being wiped when the value of the field with the field message changes) been doing my head in for about an hour - I've been trying to get a UI Policy which is using showFieldMsg when trigger conditions on one or either of two fields is true, but where the field message is attached to the bottom-most of the two fields... I was finding the message was being set correctly by the first field, but then wiped by the second field, even though the condition was still true and the "hideFieldMsg" script wasn't being triggered by the "reverse" condition.