g_form.showFieldMsg not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2018 08:01 PM
Hi All,
I am encountering an issue now where g_form.showFieldMsg("field name","error message","error") is not loading error message in London Service Portal for a onChange Catalog Item client script.
Would like to seek advice on this issue.
Thanks a lot for your help!
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2021 10:20 AM
This also applies when using g_form.setValue(). g_form.showFieldMsg() must come after the call to g_form.setValue() for the same field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-11-2023 04:50 PM
I was struggling with this issue and your suggestion worked perfectly.
Thank you so much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2023 05:31 PM
Just got caught out by this one and came across your post. Thanks very much.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2020 12:47 AM
Just had this issue myself, found it wasn't working on a setValue/showFieldMsg of a reference field....
g_form.setValue('user', gr.assigned_to);
g_form.setFieldMsg('user','test message','info',false);
The above wouldn't work, but if I changed the field the setFieldMsg was pointing at, it worked fine
I believe the issue was that the g_form.setValue on a reference field does an implicit lookup to the value of the user to retrieve the DisplayValue of the record, triggering a second setValue, which in turn clears any field message (although someone please correct me if I'm wrong. Changed my code to:
var grUser = new GlideRecord('sys_user');
grUser.addQuery('sys_id', gr.assigned_to);
grUser.query(callbackFunction);
...
function callbackFunction(gr) {
if (gr.next()) {
g_form.setValue('user',gr.getValue('sys_id'), gr.getDisplayValue());
g_form.showFieldMsg('user','Message here','info',false);
}
}
This did the trick for me. Posting in the hopes it will help someone else (as this was the first googled result)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2020 09:43 PM