g_form.getValue returning blank in Service Portal

Michael Fletche
Kilo Contributor

I have two issues an onLoad client script that functions on the regular form but returns blank in the ServicePortal.

UI Type: All

Type: onLoad

function onLoad() {

g_form.setMandatory('short_description',false);

}

This works on the IDE forms, but does not work on the Form widget.

UI Type: All

Type: onLoad

function onLoad() {

var test = g_form.getValue('short_description');

alert(test);

}

This also works fine on the IDE forms, but does not work on the Form widget.

This is a scoped table and a global widget... I do not know if that matters.

Also, g_form.getSysId() works in both, so some g_form functionality works and others do not.  There are a number of other posts about the same issue, so any insight would be appreciated.

1 REPLY 1

Brandon Barret1
Mega Sage

https://community.servicenow.com/community?id=community_question&sys_id=7e6c47a5db9cdbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=724583addbd8dbc01dcaf3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=264047a1db98dbc01dcaf3231f96...

This seems to be a relatively common Service Portal issue across Kingston and Helsinki Form Widget versions, but I was unable to find a post of it having happened in London. Two of the fixes I have seen:

1. DOM Manipulation...a bit of a "no no"

2. Applying a patch that fixes the issue. It is referenced in one of the above posts, but again, that was an instance run on Helsinki.

If this is indeed a bug, which it might be, could you use GlideAjax or a GlideRecord to access the value? It depends on your use case, but this issue seems specific to the Service Portal's Form Widget.

I wish I could offer more insight, and having just gotten into the Service Portal, am quite interested in finding a sustainable solution.

Cheers