g_form.SetValue() not working in Service Portal (Kingston patch3)

Ayushi Agarwal
Kilo Contributor

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.

17 REPLIES 17

Can you try to set the default value for variable "Comments" as "javascript: Date()"

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.

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

ifti122
Tera Guru

Same issue is here. I was struggling yesterday but was quite sure that its introduced in Kingston release. It works in service Catalog but no effect whatsoever in service portal. 

 

find_real_file.png

Rudi2
Giga Guru

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