g_form.SetValue() not working in Service Portal (Kingston patch3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2018 02:22 AM
Hi Everyone,
I am using a basic g_form.setValue function for a catalog item variable.
Eg:-
function onLoad() {
//Type appropriate comment here, and begin script below
//var a = g_form.getValue('test_name');
g_form.setValue('comments',new Date());
//alert(g_form.getValue('choice'));
}
When I test the catalog item from the Service Catalog, this code is working. However, when trying to test within Service Portal, it's not able to set up the field values.
I tried hardcoding the value and even use the values of some other field, but it is not populating the field on the service portal.
Note: Our instance recently upgraded to Kingston.
Kindly suggest a solution for this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2018 02:50 AM
Can you try to set the default value for variable "Comments" as "javascript: Date()"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2018 02:55 AM
I will do!
The reply we got from ServiceNow Support is that it will be fixed in the 4th Patch which is set to released in the 1st week in April, which is any day now.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2018 06:15 AM
Hi Ayushi
We have Scheduled the upgrade for patch 4.
Service Portal PRB1248054 |
Service Portal Service Catalog - g_form.setValue() does not work in onLoad scripts |
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2018 03:34 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2018 05:54 AM
Okay, so we have upgraded to Kingston patch 4, but it seems like GlideRecord was a problem. We changed it to use a GlideAjax and it works