g_form.showFieldMsg Client scripts is not working on portal

manibaig
Mega Guru

UI Type= All. Below script works fine in servicenow(Kingston) but it's not working on portal. Field message does display on portal for a split second though . Any suggestions guys Thanks 

function onLoad() {
var WTest = g_form.getValue('u_w_status');
if ( WTest== 'Awaiting') {
// alert('What');
g_form.showFieldMsg('WTest','Disclaimer .........' , 'info' , true);
}
}

1 ACCEPTED SOLUTION

Stacy1
Mega Guru

the info,true works great for me.  Are you remembering to hide the message also if it's false.

 

Here is an example of my script and it works great on the portal.

 

function onChange(control, oldValue, newValue, isLoading) {
// if (isLoading || newValue == 'prod') {
if (g_form.getValue('var_environment') == 'prod'){
g_form.showFieldMsg('var_environment', 'INFORMATION: Sandman will not run against this environment','info',true);
}
else{
g_form.hideFieldMsg('var_environment');
}
}

View solution in original post

14 REPLIES 14

onChange script didn't work either on portal (it worked on the form in servicenow but not on portal)

Are you still seeing the message appear briefly before it's gone?

for a fraction of a second when i refresh the portal page. is there any other workaround then Show message? can i display a text but it can't be a pop up message or message on the top of the page (gs messages)

You can do a form message on top of the form or an annotation next to the field, but I don't think those will work for what you want to do.  The annotation doesn't require any scripting, but will always be shown.  The form message won't show next to the field.

Are there any other client scripts or UI policies that are running that you could turn off temporarily to see if they are conflicting with or overriding the behavior of this script?

Also, can you post a screenshot of your client script?